1- import { beforeEach , describe , expect , it , jest , spyOn } from "bun:test" ;
1+ import { beforeEach , describe , expect , jest , spyOn , test } from "bun:test" ;
22
33import { LEVELS , type LevelId } from "~/lib/game/core/levels" ;
44import {
@@ -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
266266describe ( "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 ( ) ;
0 commit comments