Don't use names for item suggestions
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user