1
- import { describe , it , expect } from 'vitest' ;
2
- import { render , screen , act } from '@testing-library/react' ;
3
- import { TodoProvider , useTodoStore , getFilteredTodos } from '../todo-context' ;
1
+ import { act , render , screen } from '@testing-library/react' ;
4
2
import type { Todo } from '@todo-starter/utils' ;
3
+ import { describe , expect , it } from 'vitest' ;
4
+ import { getFilteredTodos , TodoProvider , useTodoStore } from '../todo-context' ;
5
5
6
6
// Mock crypto.randomUUID for consistent testing
7
7
Object . defineProperty ( global , 'crypto' , {
@@ -27,7 +27,11 @@ function TestComponent() {
27
27
< button type = "button" onClick = { ( ) => todos . length > 0 && deleteTodo ( todos [ 0 ] . id ) } data-testid = "delete-todo" >
28
28
Delete First Todo
29
29
</ button >
30
- < button type = "button" onClick = { ( ) => todos . length > 0 && updateTodo ( todos [ 0 ] . id , 'Updated text' ) } data-testid = "update-todo" >
30
+ < button
31
+ type = "button"
32
+ onClick = { ( ) => todos . length > 0 && updateTodo ( todos [ 0 ] . id , 'Updated text' ) }
33
+ data-testid = "update-todo"
34
+ >
31
35
Update First Todo
32
36
</ button >
33
37
< button type = "button" onClick = { ( ) => setFilter ( 'active' ) } data-testid = "set-filter" >
@@ -144,7 +148,9 @@ describe('todo-context', () => {
144
148
// Suppress console.error for this test
145
149
const originalError = console . error ;
146
150
// Provide a no-op replacement with a body to satisfy linter
147
- console . error = ( ..._args : unknown [ ] ) => { /* intentionally empty */ } ;
151
+ console . error = ( ..._args : unknown [ ] ) => {
152
+ /* intentionally empty */
153
+ } ;
148
154
149
155
expect ( ( ) => {
150
156
render ( < TestComponent /> ) ;
0 commit comments