@@ -10,12 +10,12 @@ describe("Todo Storage", () => {
1010
1111 beforeEach ( async ( ) => {
1212 // Create a temporary directory for each test
13- tempDir = await fs . mkdtemp ( path . join ( os . tmpdir ( ) , "todo-test-" ) ) ;
13+ runtimeTempDir = await fs . mkdtemp ( path . join ( os . tmpdir ( ) , "todo-test-" ) ) ;
1414 } ) ;
1515
1616 afterEach ( async ( ) => {
1717 // Clean up temporary directory after each test
18- await fs . rm ( tempDir , { recursive : true , force : true } ) ;
18+ await fs . rm ( runtimeTempDir , { recursive : true , force : true } ) ;
1919 } ) ;
2020
2121 describe ( "setTodosForTempDir" , ( ) => {
@@ -35,9 +35,9 @@ describe("Todo Storage", () => {
3535 } ,
3636 ] ;
3737
38- await setTodosForTempDir ( tempDir , todos ) ;
38+ await setTodosForTempDir ( runtimeTempDir , todos ) ;
3939
40- const storedTodos = await getTodosForTempDir ( tempDir ) ;
40+ const storedTodos = await getTodosForTempDir ( runtimeTempDir ) ;
4141 expect ( storedTodos ) . toEqual ( todos ) ;
4242 } ) ;
4343
@@ -54,7 +54,7 @@ describe("Todo Storage", () => {
5454 } ,
5555 ] ;
5656
57- await setTodosForTempDir ( tempDir , initialTodos ) ;
57+ await setTodosForTempDir ( runtimeTempDir , initialTodos ) ;
5858
5959 // Replace with updated list
6060 const updatedTodos : TodoItem [ ] = [
@@ -72,26 +72,26 @@ describe("Todo Storage", () => {
7272 } ,
7373 ] ;
7474
75- await setTodosForTempDir ( tempDir , updatedTodos ) ;
75+ await setTodosForTempDir ( runtimeTempDir , updatedTodos ) ;
7676
7777 // Verify list was replaced, not merged
78- const storedTodos = await getTodosForTempDir ( tempDir ) ;
78+ const storedTodos = await getTodosForTempDir ( runtimeTempDir ) ;
7979 expect ( storedTodos ) . toEqual ( updatedTodos ) ;
8080 } ) ;
8181
8282 it ( "should handle empty todo list" , async ( ) => {
8383 // Create initial list
84- await setTodosForTempDir ( tempDir , [
84+ await setTodosForTempDir ( runtimeTempDir , [
8585 {
8686 content : "Task 1" ,
8787 status : "pending" ,
8888 } ,
8989 ] ) ;
9090
9191 // Clear list
92- await setTodosForTempDir ( tempDir , [ ] ) ;
92+ await setTodosForTempDir ( runtimeTempDir , [ ] ) ;
9393
94- const storedTodos = await getTodosForTempDir ( tempDir ) ;
94+ const storedTodos = await getTodosForTempDir ( runtimeTempDir ) ;
9595 expect ( storedTodos ) . toEqual ( [ ] ) ;
9696 } ) ;
9797
@@ -108,10 +108,10 @@ describe("Todo Storage", () => {
108108 { content : "Task 8" , status : "pending" } ,
109109 ] ;
110110
111- await expect ( setTodosForTempDir ( tempDir , tooManyTodos ) ) . rejects . toThrow (
111+ await expect ( setTodosForTempDir ( runtimeTempDir , tooManyTodos ) ) . rejects . toThrow (
112112 / T o o m a n y T O D O s \( 8 \/ 7 \) / i
113113 ) ;
114- await expect ( setTodosForTempDir ( tempDir , tooManyTodos ) ) . rejects . toThrow (
114+ await expect ( setTodosForTempDir ( runtimeTempDir , tooManyTodos ) ) . rejects . toThrow (
115115 / K e e p h i g h p r e c i s i o n a t t h e c e n t e r / i
116116 ) ;
117117 } ) ;
@@ -127,8 +127,8 @@ describe("Todo Storage", () => {
127127 { content : "Future work (5 items)" , status : "pending" } ,
128128 ] ;
129129
130- await setTodosForTempDir ( tempDir , maxTodos ) ;
131- expect ( await getTodosForTempDir ( tempDir ) ) . toEqual ( maxTodos ) ;
130+ await setTodosForTempDir ( runtimeTempDir , maxTodos ) ;
131+ expect ( await getTodosForTempDir ( runtimeTempDir ) ) . toEqual ( maxTodos ) ;
132132 } ) ;
133133
134134 it ( "should reject multiple in_progress tasks" , async ( ) => {
@@ -139,7 +139,7 @@ describe("Todo Storage", () => {
139139 } ,
140140 ] ;
141141
142- await setTodosForTempDir ( tempDir , validTodos ) ;
142+ await setTodosForTempDir ( runtimeTempDir , validTodos ) ;
143143
144144 const invalidTodos : TodoItem [ ] = [
145145 {
@@ -152,12 +152,12 @@ describe("Todo Storage", () => {
152152 } ,
153153 ] ;
154154
155- await expect ( setTodosForTempDir ( tempDir , invalidTodos ) ) . rejects . toThrow (
155+ await expect ( setTodosForTempDir ( runtimeTempDir , invalidTodos ) ) . rejects . toThrow (
156156 / o n l y o n e t a s k c a n b e m a r k e d a s i n _ p r o g r e s s / i
157157 ) ;
158158
159159 // Original todos should remain unchanged on failure
160- expect ( await getTodosForTempDir ( tempDir ) ) . toEqual ( validTodos ) ;
160+ expect ( await getTodosForTempDir ( runtimeTempDir ) ) . toEqual ( validTodos ) ;
161161 } ) ;
162162
163163 it ( "should reject when in_progress tasks appear after pending" , async ( ) => {
@@ -172,7 +172,7 @@ describe("Todo Storage", () => {
172172 } ,
173173 ] ;
174174
175- await expect ( setTodosForTempDir ( tempDir , invalidTodos ) ) . rejects . toThrow (
175+ await expect ( setTodosForTempDir ( runtimeTempDir , invalidTodos ) ) . rejects . toThrow (
176176 / i n - p r o g r e s s t a s k s m u s t a p p e a r b e f o r e p e n d i n g t a s k s / i
177177 ) ;
178178 } ) ;
@@ -189,7 +189,7 @@ describe("Todo Storage", () => {
189189 } ,
190190 ] ;
191191
192- await expect ( setTodosForTempDir ( tempDir , invalidTodos ) ) . rejects . toThrow (
192+ await expect ( setTodosForTempDir ( runtimeTempDir , invalidTodos ) ) . rejects . toThrow (
193193 / c o m p l e t e d t a s k s m u s t a p p e a r b e f o r e i n - p r o g r e s s o r p e n d i n g t a s k s / i
194194 ) ;
195195 } ) ;
@@ -206,14 +206,14 @@ describe("Todo Storage", () => {
206206 } ,
207207 ] ;
208208
209- await setTodosForTempDir ( tempDir , todos ) ;
210- expect ( await getTodosForTempDir ( tempDir ) ) . toEqual ( todos ) ;
209+ await setTodosForTempDir ( runtimeTempDir , todos ) ;
210+ expect ( await getTodosForTempDir ( runtimeTempDir ) ) . toEqual ( todos ) ;
211211 } ) ;
212212 } ) ;
213213
214214 describe ( "getTodosForTempDir" , ( ) => {
215215 it ( "should return empty array when no todos exist" , async ( ) => {
216- const todos = await getTodosForTempDir ( tempDir ) ;
216+ const todos = await getTodosForTempDir ( runtimeTempDir ) ;
217217 expect ( todos ) . toEqual ( [ ] ) ;
218218 } ) ;
219219
@@ -229,9 +229,9 @@ describe("Todo Storage", () => {
229229 } ,
230230 ] ;
231231
232- await setTodosForTempDir ( tempDir , todos ) ;
232+ await setTodosForTempDir ( runtimeTempDir , todos ) ;
233233
234- const retrievedTodos = await getTodosForTempDir ( tempDir ) ;
234+ const retrievedTodos = await getTodosForTempDir ( runtimeTempDir ) ;
235235 expect ( retrievedTodos ) . toEqual ( todos ) ;
236236 } ) ;
237237 } ) ;
@@ -283,11 +283,11 @@ describe("Todo Storage", () => {
283283 } ,
284284 ] ;
285285
286- await setTodosForTempDir ( tempDir , todos ) ;
287- expect ( await getTodosForTempDir ( tempDir ) ) . toEqual ( todos ) ;
286+ await setTodosForTempDir ( runtimeTempDir , todos ) ;
287+ expect ( await getTodosForTempDir ( runtimeTempDir ) ) . toEqual ( todos ) ;
288288
289- await clearTodosForTempDir ( tempDir ) ;
290- expect ( await getTodosForTempDir ( tempDir ) ) . toEqual ( [ ] ) ;
289+ await clearTodosForTempDir ( runtimeTempDir ) ;
290+ expect ( await getTodosForTempDir ( runtimeTempDir ) ) . toEqual ( [ ] ) ;
291291 } ) ;
292292 } ) ;
293293} ) ;
0 commit comments