Don't use names for item suggestions

This commit is contained in:
2026-09-27 00:45:00 -03:00
parent 8c7ca92891
commit 52587aabf7
5 changed files with 16 additions and 27 deletions
+3 -7
View File
@@ -114,7 +114,7 @@ Deno.test("suggestions are for the word being typed, from words, types and provi
assertEquals(suggest("say a ").texts, []);
});
Deno.test("/give suggests items as they're typed, with their names", async () => {
Deno.test("/give suggests item ids as they're typed", async () => {
const { join, take, send } = await test_game("mods");
join(1, "alice");
take(1);
@@ -126,12 +126,8 @@ Deno.test("/give suggests items as they're typed, with their names", async () =>
const carrots = suggest("/give car");
assertEquals(carrots.id, 3);
assertEquals(carrots.start, 6);
assert(
carrots.suggestions.some((s: { text: string; tooltip: string }) =>
s.text === "bworld:carrot" && s.tooltip === "Carrot"
),
);
assert(carrots.suggestions.every((s: { text: string }) => s.text.split(":")[1].startsWith("car")));
// just the ids
assertEquals(carrots.suggestions, [{ text: "bworld:carrot" }]);
// every item, but not air
const all = suggest("/give ").suggestions.map((s: { text: string }) => s.text);