Skip to content

Commit c433020

Browse files
committed
fix tests
1 parent f45177e commit c433020

File tree

2 files changed

+21
-18
lines changed

2 files changed

+21
-18
lines changed

src/__tests__/timers.test.js

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,26 @@
11
import waitFor from '../waitFor';
2-
import { FakeTimerTypes, setupFakeTimers } from './timerUtils';
2+
import { TimerMode, setupFakeTimers } from './timerUtils';
33

4-
describe.each(FakeTimerTypes)('%s fake timers tests', (fakeTimerType) => {
5-
beforeEach(() => setupFakeTimers(fakeTimerType));
4+
describe.each([TimerMode.Default, TimerMode.Legacy])(
5+
'%s fake timers tests',
6+
(fakeTimerType) => {
7+
beforeEach(() => setupFakeTimers(fakeTimerType));
68

7-
test('it successfully runs tests', () => {
8-
expect(true).toBeTruthy();
9-
});
10-
11-
test('it successfully uses waitFor', async () => {
12-
await waitFor(() => {
9+
test('it successfully runs tests', () => {
1310
expect(true).toBeTruthy();
1411
});
15-
});
1612

17-
test('it successfully uses waitFor with real timers', async () => {
18-
jest.useRealTimers();
19-
await waitFor(() => {
20-
expect(true).toBeTruthy();
13+
test('it successfully uses waitFor', async () => {
14+
await waitFor(() => {
15+
expect(true).toBeTruthy();
16+
});
17+
});
18+
19+
test('it successfully uses waitFor with real timers', async () => {
20+
jest.useRealTimers();
21+
await waitFor(() => {
22+
expect(true).toBeTruthy();
23+
});
2124
});
22-
});
23-
});
25+
}
26+
);

src/__tests__/waitForElementToBeRemoved.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import React, { useState } from 'react';
33
import { View, Text, TouchableOpacity } from 'react-native';
44
import { render, fireEvent, waitForElementToBeRemoved } from '..';
5-
import { FakeTimerTypes, setupFakeTimers } from './timerUtils';
5+
import { TimerMode, setupFakeTimers } from './timerUtils';
66

77
const TestSetup = ({ shouldUseDelay = true }) => {
88
const [isAdded, setIsAdded] = useState(true);
@@ -131,7 +131,7 @@ test('waits with custom interval', async () => {
131131
expect(mockFn).toHaveBeenCalledTimes(4);
132132
});
133133

134-
test.each(FakeTimerTypes)(
134+
test.each([TimerMode.Default, TimerMode.Legacy])(
135135
'works with %s fake timers',
136136
async (fakeTimerType) => {
137137
setupFakeTimers(fakeTimerType);

0 commit comments

Comments
 (0)