Chess minigame
This commit is contained in:
@@ -541,3 +541,28 @@ Deno.test("the maze minigame loses the fish after 8 seconds, whatever the diffic
|
||||
}
|
||||
}, "maze");
|
||||
});
|
||||
|
||||
Deno.test("the chess minigame lands the fish when its screen says the mate was played, and has the maze's time", async () => {
|
||||
const t = await setup();
|
||||
const closes = () => t.take(1).some((m: Msg) => m.type === "close_menu");
|
||||
await with_minigames(async () => {
|
||||
t.send(1, { type: "chat", text: "/fish cod" });
|
||||
let opened = opened_menu(t.take(1));
|
||||
assertEquals(opened.data, { ticks_left: 160, time: 160 });
|
||||
t.send(1, { type: "menu_button", menu: opened.id, button: 0 });
|
||||
t.game.tick();
|
||||
assert(closes());
|
||||
assertEquals(t.fish().length, 0);
|
||||
|
||||
t.send(1, { type: "chat", text: "/fish cod" });
|
||||
opened = opened_menu(t.take(1));
|
||||
t.send(1, { type: "menu_button", menu: opened.id, button: 1 });
|
||||
assertEquals(t.fish().map((i: Msg) => i.id), ["bworld:cod"]);
|
||||
|
||||
t.send(1, { type: "chat", text: "/fish cod" });
|
||||
t.take(1);
|
||||
for (let i = 0; i < 161; i++) t.game.tick();
|
||||
assert(closes());
|
||||
assertEquals(t.fish().length, 1);
|
||||
}, "chess");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user