Skip to content

Commit 7c5f51f

Browse files
committed
more tests
1 parent 17b146a commit 7c5f51f

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

src/__tests__/cleanup.test.tsx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as React from 'react';
22
import { View } from 'react-native';
33

4-
import { cleanupAsync, render } from '../pure';
4+
import { cleanupAsync, render, renderAsync } from '../pure';
55

66
class Test extends React.Component<{ onUnmount: () => void }> {
77
componentWillUnmount() {
@@ -14,7 +14,7 @@ class Test extends React.Component<{ onUnmount: () => void }> {
1414
}
1515
}
1616

17-
test('cleanup', async () => {
17+
test('cleanup after render', async () => {
1818
const fn = jest.fn();
1919

2020
render(<Test onUnmount={fn} />);
@@ -24,3 +24,14 @@ test('cleanup', async () => {
2424
await cleanupAsync();
2525
expect(fn).toHaveBeenCalledTimes(2);
2626
});
27+
28+
test('cleanup after renderAsync', async () => {
29+
const fn = jest.fn();
30+
31+
await renderAsync(<Test onUnmount={fn} />);
32+
await renderAsync(<Test onUnmount={fn} />);
33+
expect(fn).not.toHaveBeenCalled();
34+
35+
await cleanupAsync();
36+
expect(fn).toHaveBeenCalledTimes(2);
37+
});

0 commit comments

Comments
 (0)