fix(houseofrc): match a class by whole words, e.g. 4wd to 4WD Buggy (1.81.1)

This commit is contained in:
larssand committed 2026-11-08 16:07:48 +01:00
1 parent b0f2b92c04
commit cdeb6b0402
5 files changed
+22 -5

No files matched your search

+5
View File
@@ -67,4 +67,9 @@ test("House of RC entries: matched on member, transponder or name; other class a
assert.deepEqual([dan.name, dan.transponder, dan.club, dan.houseOfRcId], ["Dan Ny", "666", "Sundsvall RC", "8"]);
assert.equal(matchHouseOfRcClass([{ id: "c1", name: "Offroad 2WD foam" }], "offroad 2wd Foam"), "c1");
assert.equal(matchHouseOfRcClass([{ id: "c1", name: "Touring" }], "F1"), "");
const ours = [{ id: "s", name: "Stock 17.5T" }, { id: "b2", name: "2WD Buggy" }, { id: "b4", name: "4WD Buggy" }, { id: "x2", name: "2wd" }];
assert.equal(matchHouseOfRcClass(ours, "4wd"), "b4", "a whole word of one class");
assert.equal(matchHouseOfRcClass(ours, "2wd"), "x2", "an exact name wins");
assert.equal(matchHouseOfRcClass(ours, "Buggy"), "", "two candidates: let the user choose");
assert.equal(matchHouseOfRcClass(ours, "17.5"), "", "part of a word is no match");
});