File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -43,28 +43,29 @@ describe('AnimatedView', () => {
43
43
jest . useRealTimers ( ) ;
44
44
} ) ;
45
45
46
- it ( 'should use native driver when useNativeDriver is true' , ( ) => {
46
+ it ( 'should use native driver when useNativeDriver is true' , async ( ) => {
47
47
render (
48
48
< AnimatedView fadeInDuration = { 250 } useNativeDriver = { true } >
49
49
Test
50
50
</ AnimatedView > ,
51
51
) ;
52
52
expect ( screen . root ) . toHaveStyle ( { opacity : 0 } ) ;
53
53
54
- act ( ( ) => jest . advanceTimersByTime ( 250 ) ) ;
55
- // This stopped working in tests in RN 0.77
56
- // expect(screen.root).toHaveStyle({ opacity: 0 });
54
+ // eslint-disable-next-line require-await
55
+ await act ( async ( ) => jest . advanceTimersByTime ( 250 ) ) ;
56
+ expect ( screen . root ) . toHaveStyle ( { opacity : 0 } ) ;
57
57
} ) ;
58
58
59
- it ( 'should not use native driver when useNativeDriver is false' , ( ) => {
59
+ it ( 'should not use native driver when useNativeDriver is false' , async ( ) => {
60
60
render (
61
61
< AnimatedView fadeInDuration = { 250 } useNativeDriver = { false } >
62
62
Test
63
63
</ AnimatedView > ,
64
64
) ;
65
65
expect ( screen . root ) . toHaveStyle ( { opacity : 0 } ) ;
66
66
67
- act ( ( ) => jest . advanceTimersByTime ( 250 ) ) ;
67
+ // eslint-disable-next-line require-await
68
+ await act ( async ( ) => jest . advanceTimersByTime ( 250 ) ) ;
68
69
expect ( screen . root ) . toHaveStyle ( { opacity : 1 } ) ;
69
70
} ) ;
70
71
} ) ;
You can’t perform that action at this time.
0 commit comments