Skip to content

Commit 487c5dd

Browse files
committed
refactor: move mocks after imports
1 parent 3358d8a commit 487c5dd

File tree

3 files changed

+34
-34
lines changed

3 files changed

+34
-34
lines changed

package/src/components/UIComponents/__tests__/PortalWhileClosingView.test.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
import React from 'react';
2+
import { Text } from 'react-native';
3+
4+
import { act, cleanup, render, screen } from '@testing-library/react-native';
5+
6+
import * as stateStore from '../../../state-store';
7+
import { PortalWhileClosingView } from '../PortalWhileClosingView';
8+
19
jest.mock('../../../state-store', () => {
210
const actual = jest.requireActual('../../../state-store');
311
const createClosingPortalLayoutRegistrationId = jest.fn(() => 'registration-1');
@@ -13,14 +21,6 @@ jest.mock('../../../state-store', () => {
1321
});
1422
});
1523

16-
import React from 'react';
17-
import { Text } from 'react-native';
18-
19-
import { act, cleanup, render, screen } from '@testing-library/react-native';
20-
21-
import * as stateStore from '../../../state-store';
22-
import { PortalWhileClosingView } from '../PortalWhileClosingView';
23-
2424
const BASE_RECT = { h: 48, w: 120, x: 12, y: 24 };
2525

2626
const flushAnimationFrameQueue = () => {

package/src/contexts/overlayContext/__tests__/ClosingPortalHostsLayer.test.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
import React from 'react';
2+
import { StyleSheet } from 'react-native';
3+
import type { SharedValue } from 'react-native-reanimated';
4+
5+
import { act, cleanup, render, screen } from '@testing-library/react-native';
6+
7+
import { clearClosingPortalLayout, setClosingPortalLayout } from '../../../state-store';
8+
import { ClosingPortalHostsLayer } from '../ClosingPortalHostsLayer';
9+
110
jest.mock('react-native-reanimated', () => {
211
const actual = jest.requireActual('react-native-reanimated/mock');
312
const { View } = require('react-native');
@@ -17,15 +26,6 @@ jest.mock('react-native-reanimated', () => {
1726
};
1827
});
1928

20-
import React from 'react';
21-
import { StyleSheet } from 'react-native';
22-
import type { SharedValue } from 'react-native-reanimated';
23-
24-
import { act, cleanup, render, screen } from '@testing-library/react-native';
25-
26-
import { clearClosingPortalLayout, setClosingPortalLayout } from '../../../state-store';
27-
import { ClosingPortalHostsLayer } from '../ClosingPortalHostsLayer';
28-
2929
const FIRST_RECT = { h: 40, w: 100, x: 10, y: 20 };
3030
const SECOND_RECT = { h: 52, w: 140, x: 30, y: 45 };
3131

package/src/contexts/overlayContext/__tests__/MessageOverlayHostLayer.test.tsx

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
import React from 'react';
2+
import { StyleSheet, Text } from 'react-native';
3+
4+
import * as SafeAreaContext from 'react-native-safe-area-context';
5+
6+
import { act, cleanup, fireEvent, render, screen } from '@testing-library/react-native';
7+
8+
import {
9+
finalizeCloseOverlay,
10+
openOverlay,
11+
overlayStore,
12+
setOverlayBottomH,
13+
setOverlayMessageH,
14+
setOverlayTopH,
15+
} from '../../../state-store';
16+
import { MessageOverlayHostLayer } from '../MessageOverlayHostLayer';
17+
118
jest.mock('react-native', () => {
219
const actual = jest.requireActual('react-native');
320

@@ -65,23 +82,6 @@ jest.mock('react-native-reanimated', () => {
6582
};
6683
});
6784

68-
import React from 'react';
69-
import { StyleSheet, Text } from 'react-native';
70-
71-
import * as SafeAreaContext from 'react-native-safe-area-context';
72-
73-
import { act, cleanup, fireEvent, render, screen } from '@testing-library/react-native';
74-
75-
import {
76-
finalizeCloseOverlay,
77-
openOverlay,
78-
overlayStore,
79-
setOverlayBottomH,
80-
setOverlayMessageH,
81-
setOverlayTopH,
82-
} from '../../../state-store';
83-
import { MessageOverlayHostLayer } from '../MessageOverlayHostLayer';
84-
8585
const TOP_RECT = { h: 20, w: 90, x: 5, y: 0 };
8686
const MESSAGE_RECT = { h: 50, w: 180, x: 10, y: 0 };
8787
const BOTTOM_RECT = { h: 30, w: 140, x: 20, y: 100 };

0 commit comments

Comments
 (0)