@@ -4,7 +4,7 @@ import { useRecoilState } from 'recoil'
4
4
5
5
import type { AppState } from '../../../dataStructure'
6
6
import { recoilState } from '../../../dataStructure'
7
- import { renderWithRecoilRoot } from '../../../testUtil'
7
+ import { TestRenderer } from '../../../testUtil'
8
8
9
9
import Item from './index'
10
10
@@ -29,7 +29,7 @@ const App = () => {
29
29
}
30
30
31
31
test ( 'should each initialAppstate todo object value is set to Item element' , ( ) => {
32
- renderWithRecoilRoot (
32
+ TestRenderer (
33
33
< Item todo = { initialRecoilState . todoList [ 0 ] } /> ,
34
34
initialRecoilState
35
35
)
@@ -46,15 +46,15 @@ test('should each initialAppstate todo object value is set to Item element', ()
46
46
} )
47
47
48
48
test ( 'should set css classes correctly' , ( ) => {
49
- renderWithRecoilRoot ( < App /> , initialRecoilState )
49
+ TestRenderer ( < App /> , initialRecoilState )
50
50
51
51
// when not.completed & not.onEdit, SwitchStyle doesn't show .completed .editting selectors
52
52
expect ( screen . getByTestId ( 'todo-item' ) ) . not . toHaveClass ( 'completed' )
53
53
expect ( screen . getByTestId ( 'todo-item' ) ) . not . toHaveClass ( 'editing' )
54
54
} )
55
55
56
56
test ( 'should work todo completed checkbox' , ( ) => {
57
- renderWithRecoilRoot ( < App /> , initialRecoilState )
57
+ TestRenderer ( < App /> , initialRecoilState )
58
58
59
59
// click complete checkbox then should appear completed class
60
60
fireEvent . click ( screen . getByTestId ( 'todo-item-complete-check' ) )
@@ -72,7 +72,7 @@ test('should work todo completed checkbox', () => {
72
72
} )
73
73
74
74
test ( 'should work edit mode and toggle show/hide' , ( ) => {
75
- renderWithRecoilRoot ( < App /> , initialRecoilState )
75
+ TestRenderer ( < App /> , initialRecoilState )
76
76
77
77
// by default, edit input form is not visible
78
78
expect ( screen . getByTestId ( 'todo-edit-input' ) ) . not . toBeVisible ( )
@@ -109,7 +109,7 @@ test('should work edit mode and toggle show/hide', () => {
109
109
} )
110
110
111
111
test ( 'delete todo item' , ( ) => {
112
- renderWithRecoilRoot ( < App /> , initialRecoilState )
112
+ TestRenderer ( < App /> , initialRecoilState )
113
113
114
114
// click delete button, then todo item is removed
115
115
expect ( screen . getByTestId ( 'todo-item' ) ) . toBeInTheDocument ( )
0 commit comments