Skip to content

Commit 6b287f9

Browse files
committed
change all it to test
1 parent 35923c8 commit 6b287f9

4 files changed

Lines changed: 30 additions & 30 deletions

File tree

tests/data-store.test.ts

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { beforeEach, describe, expect, it, jest, spyOn } from "bun:test";
1+
import { beforeEach, describe, expect, jest, spyOn, test } from "bun:test";
22

33
import { LEVELS, type LevelId } from "~/lib/game/core/levels";
44
import {
@@ -12,26 +12,26 @@ describe("HandleData", () => {
1212
jest.clearAllMocks();
1313
});
1414

15-
it("should create HandleData with number value", () => {
15+
test("should create HandleData with number value", () => {
1616
const handle = new HandleData("import", 42);
1717
expect(handle.access).toBe("import");
1818
expect(handle.getValue()).toBe(42);
1919
});
2020

21-
it("should create HandleData with function value", () => {
21+
test("should create HandleData with function value", () => {
2222
const mockFn = jest.fn(() => 100);
2323
const handle = new HandleData("export", mockFn);
2424
expect(handle.access).toBe("export");
2525
expect(handle.getValue()).toBe(100);
2626
expect(mockFn).toHaveBeenCalledTimes(1);
2727
});
2828

29-
it("should return 0 for invalid value types", () => {
29+
test("should return 0 for invalid value types", () => {
3030
const handle = new HandleData("all", "invalid" as any);
3131
expect(handle.getValue()).toBe(0);
3232
});
3333

34-
it("should update value with setValue", () => {
34+
test("should update value with setValue", () => {
3535
const handle = new HandleData("import", 10);
3636
handle.setValue(20);
3737
expect(handle.getValue()).toBe(20);
@@ -55,15 +55,15 @@ describe("useDataStore", () => {
5555
});
5656

5757
describe("initial state", () => {
58-
it("should have correct initial state", () => {
58+
test("should have correct initial state", () => {
5959
expect(useDataStore.getState().initData).toBe(true);
6060
expect(useDataStore.getState().gameObjects).toBeInstanceOf(Map);
6161
expect(useDataStore.getState().gameObjects.size).toBe(0);
6262
});
6363
});
6464

6565
describe("reset", () => {
66-
it("should reset store with level data for all levels", () => {
66+
test("should reset store with level data for all levels", () => {
6767
// Test each level in LEVELS
6868
Object.entries(LEVELS).forEach(([_, level]) => {
6969
// Reset store for current level
@@ -110,14 +110,14 @@ describe("useDataStore", () => {
110110
useDataStore.getState().reset("calculator");
111111
});
112112

113-
it("should set and get numeric data", () => {
113+
test("should set and get numeric data", () => {
114114
useDataStore.getState().setData("raccoon", "solution", 42);
115115

116116
const value = useDataStore.getState().getData("raccoon", "solution");
117117
expect(value).toBe(42);
118118
});
119119

120-
it("should set and get function data", () => {
120+
test("should set and get function data", () => {
121121
const mockFn = jest.fn(() => 100);
122122

123123
useDataStore.getState().setData("raccoon", "solution", mockFn);
@@ -133,7 +133,7 @@ describe("useDataStore", () => {
133133
useDataStore.getState().reset("calculator");
134134
});
135135

136-
it("should add new handle", () => {
136+
test("should add new handle", () => {
137137
useDataStore.getState().addHandle("raccoon", "newHandle");
138138

139139
const gameObject1Data = useDataStore
@@ -147,7 +147,7 @@ describe("useDataStore", () => {
147147
expect(newHandle!.getValue()).toBe(0);
148148
});
149149

150-
it("should not add duplicate handle", () => {
150+
test("should not add duplicate handle", () => {
151151
const initialSize = useDataStore
152152
.getState()
153153
.gameObjects.get("raccoon")!.size;
@@ -160,7 +160,7 @@ describe("useDataStore", () => {
160160
expect(finalSize).toBe(initialSize);
161161
});
162162

163-
it("should remove handle", () => {
163+
test("should remove handle", () => {
164164
useDataStore.getState().addHandle("raccoon", "newHandle");
165165
useDataStore.getState().removeHandle("raccoon", "newHandle");
166166

@@ -179,7 +179,7 @@ describe("useDataStore", () => {
179179
useDataStore.getState().reset("calculator");
180180
});
181181

182-
it("should save store state to localStorage", () => {
182+
test("should save store state to localStorage", () => {
183183
const store = useDataStore.getState();
184184

185185
store.reset(localStorage.getItem("level")! as LevelId);
@@ -199,7 +199,7 @@ describe("useDataStore", () => {
199199
);
200200
});
201201

202-
it("should initialize from localStorage when data exists", () => {
202+
test("should initialize from localStorage when data exists", () => {
203203
// Prepare saved data
204204
const savedData = {
205205
initData: false,
@@ -225,7 +225,7 @@ describe("useDataStore", () => {
225225
expect(store.getData("raccoon", "solution")).toBe(42);
226226
});
227227

228-
it("should reset when no saved data exists", () => {
228+
test("should reset when no saved data exists", () => {
229229
const store = useDataStore.getState();
230230
const resetSpy = spyOn(store, "reset");
231231

@@ -242,7 +242,7 @@ describe("createLevelDataHelpers", () => {
242242
useDataStore.getState().reset("calculator");
243243
});
244244

245-
it("should create type-safe helpers for a specific level", () => {
245+
test("should create type-safe helpers for a specific level", () => {
246246
const helpers = createLevelDataHelpers("calculator");
247247

248248
expect(helpers.initData()).toBe(true);
@@ -252,7 +252,7 @@ describe("createLevelDataHelpers", () => {
252252
expect(typeof helpers.removeHandle).toBe("function");
253253
});
254254

255-
it("should provide working setData and getData methods", () => {
255+
test("should provide working setData and getData methods", () => {
256256
const helpers = createLevelDataHelpers("calculator");
257257

258258
// These calls should be type-safe based on the level configuration
@@ -264,7 +264,7 @@ describe("createLevelDataHelpers", () => {
264264
});
265265

266266
describe("integration tests", () => {
267-
it("should handle complete workflow: reset -> modify -> save -> init", () => {
267+
test("should handle complete workflow: reset -> modify -> save -> init", () => {
268268
localStorage.clear();
269269
localStorage.setItem("level", "calculator");
270270
let store = useDataStore.getState();

tests/mouse-store.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { beforeEach, describe, expect, it, jest } from "bun:test";
1+
import { beforeEach, describe, expect, jest, test } from "bun:test";
22
import type { Vec2 } from "kaplay";
33

44
import { useMouseStore } from "~/lib/zustand/mouse";
@@ -11,13 +11,13 @@ describe("useMouseStore", () => {
1111
});
1212
});
1313

14-
it("should have initial mouse position at origin", () => {
14+
test("should have initial mouse position at origin", () => {
1515
const pos = useMouseStore.getState().getMousePos();
1616
expect(pos.x).toBe(0);
1717
expect(pos.y).toBe(0);
1818
});
1919

20-
it("should set and use mouse position function", () => {
20+
test("should set and use mouse position function", () => {
2121
const mockMousePos = jest.fn(() => ({ x: 100, y: 200 }) as Vec2);
2222
useMouseStore.getState().setMousePosFunction(mockMousePos);
2323

@@ -27,7 +27,7 @@ describe("useMouseStore", () => {
2727
expect(mockMousePos).toHaveBeenCalledTimes(1);
2828
});
2929

30-
it("should replace previous mouse position function", () => {
30+
test("should replace previous mouse position function", () => {
3131
const firstMockPos = jest.fn(() => ({ x: 50, y: 50 }) as Vec2);
3232
const secondMockPos = jest.fn(() => ({ x: 150, y: 150 }) as Vec2);
3333

tests/solutions.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import fs from "fs";
22
import path from "path";
3-
import { beforeAll, describe, expect, it } from "bun:test";
3+
import { beforeAll, describe, expect, test } from "bun:test";
44

55
import { LEVELS } from "~/lib/game/core/levels";
66

@@ -14,7 +14,7 @@ describe("solutions", () => {
1414
}
1515
});
1616

17-
it("every level should have a corresponding solution file", () => {
17+
test("every level should have a corresponding solution file", () => {
1818
const levelKeys = Object.keys(LEVELS);
1919
const missingSolutions: string[] = [];
2020

@@ -32,7 +32,7 @@ describe("solutions", () => {
3232
).toHaveLength(0);
3333
});
3434

35-
it("no orphaned solution files should exist", () => {
35+
test("no orphaned solution files should exist", () => {
3636
const levelKeys = Object.keys(LEVELS);
3737
const solutionFiles = fs
3838
.readdirSync(solutionsDir)

tests/time-store.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { beforeEach, describe, expect, it, jest } from "bun:test";
1+
import { beforeEach, describe, expect, jest, test } from "bun:test";
22

33
import { useTimeStore } from "~/lib/zustand/time";
44

@@ -11,29 +11,29 @@ describe("useTimeStore", () => {
1111
});
1212
});
1313

14-
it("should have initial time values of 0", () => {
14+
test("should have initial time values of 0", () => {
1515
const store = useTimeStore.getState();
1616
expect(store.getTime()).toBe(0);
1717
expect(store.getDeltaTime()).toBe(0);
1818
});
1919

20-
it("should set and use time function", () => {
20+
test("should set and use time function", () => {
2121
const mockTime = jest.fn(() => 1000);
2222
useTimeStore.getState().setTimeFunction(mockTime);
2323

2424
expect(useTimeStore.getState().getTime()).toBe(1000);
2525
expect(mockTime).toHaveBeenCalledTimes(1);
2626
});
2727

28-
it("should set and use delta time function", () => {
28+
test("should set and use delta time function", () => {
2929
const mockDeltaTime = jest.fn(() => 16.67);
3030
useTimeStore.getState().setDeltaTimeFunction(mockDeltaTime);
3131

3232
expect(useTimeStore.getState().getDeltaTime()).toBe(16.67);
3333
expect(mockDeltaTime).toHaveBeenCalledTimes(1);
3434
});
3535

36-
it("should replace previous time functions", () => {
36+
test("should replace previous time functions", () => {
3737
const firstMockTime = jest.fn(() => 500);
3838
const secondMockTime = jest.fn(() => 2000);
3939

0 commit comments

Comments
 (0)