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' ;
42import type { Todo } from '@todo-starter/utils' ;
3+ import { describe , expect , it } from 'vitest' ;
4+ import { getFilteredTodos , TodoProvider , useTodoStore } from '../todo-context' ;
55
66// Mock crypto.randomUUID for consistent testing
77Object . defineProperty ( global , 'crypto' , {
@@ -27,7 +27,11 @@ function TestComponent() {
2727 < button type = "button" onClick = { ( ) => todos . length > 0 && deleteTodo ( todos [ 0 ] . id ) } data-testid = "delete-todo" >
2828 Delete First Todo
2929 </ 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+ >
3135 Update First Todo
3236 </ button >
3337 < button type = "button" onClick = { ( ) => setFilter ( 'active' ) } data-testid = "set-filter" >
@@ -144,7 +148,9 @@ describe('todo-context', () => {
144148 // Suppress console.error for this test
145149 const originalError = console . error ;
146150 // 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+ } ;
148154
149155 expect ( ( ) => {
150156 render ( < TestComponent /> ) ;
0 commit comments