Skip to content

Commit c6f1721

Browse files
committed
more
1 parent f673ae7 commit c6f1721

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/__tests__/react-native-animated.test.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,28 +43,29 @@ describe('AnimatedView', () => {
4343
jest.useRealTimers();
4444
});
4545

46-
it('should use native driver when useNativeDriver is true', () => {
46+
it('should use native driver when useNativeDriver is true', async () => {
4747
render(
4848
<AnimatedView fadeInDuration={250} useNativeDriver={true}>
4949
Test
5050
</AnimatedView>,
5151
);
5252
expect(screen.root).toHaveStyle({ opacity: 0 });
5353

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 });
5757
});
5858

59-
it('should not use native driver when useNativeDriver is false', () => {
59+
it('should not use native driver when useNativeDriver is false', async () => {
6060
render(
6161
<AnimatedView fadeInDuration={250} useNativeDriver={false}>
6262
Test
6363
</AnimatedView>,
6464
);
6565
expect(screen.root).toHaveStyle({ opacity: 0 });
6666

67-
act(() => jest.advanceTimersByTime(250));
67+
// eslint-disable-next-line require-await
68+
await act(async () => jest.advanceTimersByTime(250));
6869
expect(screen.root).toHaveStyle({ opacity: 1 });
6970
});
7071
});

0 commit comments

Comments
 (0)