diff --git a/technical-fundamentals/coding/__tests__/connect4.test.mjs b/technical-fundamentals/coding/__tests__/connect4.test.mjs index 21e1f125..824181b2 100644 --- a/technical-fundamentals/coding/__tests__/connect4.test.mjs +++ b/technical-fundamentals/coding/__tests__/connect4.test.mjs @@ -1,12 +1,12 @@ -import { describe, it, expect, vi } from "vitest"; -import { Connect4, PLAYER_ONE, PLAYER_TWO } from "../connect4.mjs"; +import { describe, it, expect } from "vitest"; +import { Connect4, PLAYER_ONE } from "../connect4.mjs"; describe("Connect4", () => { it("It should allow you play within bounds", async () => { const c4 = new Connect4({ width: 10, height: 10 }); - expect(c4.getValue(10, 1)).toBeFalsy(); + expect(c4.getValue(9, 1)).toBeFalsy(); c4.play(1); - expect(c4.getValue(10, 1)).toEqual(PLAYER_ONE); + expect(c4.getValue(9, 1)).toEqual(PLAYER_ONE); }); it("It should do nothing if you play out of bounds", async () => { @@ -40,9 +40,9 @@ describe("Connect4", () => { expect(c4.winner()).toEqual(PLAYER_ONE); }); - it("it should detect diagonal winning", () => { + it("it should detect diagonal winning second", () => { const c4 = new Connect4({ width: 10, height: 10 }); - const plays = [1, 2, 2, 3, 4, 3, 3, 4, 5, 4, 4].reverse(); + const plays = [5, 4, 4, 9, 3, 3, 3, 2, 2, 2, 2]; plays.forEach((p) => c4.play(p)); expect(c4.winner()).toEqual(PLAYER_ONE); });