-
Notifications
You must be signed in to change notification settings - Fork 5
/
jest-setup.ts
32 lines (25 loc) · 1 KB
/
jest-setup.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import { WatchK8sResource } from '@openshift-console/dynamic-plugin-sdk';
import { configure } from '@testing-library/dom';
import '@testing-library/jest-dom/extend-expect';
import 'regenerator-runtime/runtime';
import '@testing-library/jest-dom';
import consoleFetchFS from './bridge/dynamic-plugin-sdk-mocks/consoleFetchFS';
import useK8sWatchResourceFS from './bridge/dynamic-plugin-sdk-mocks/useK8sWatchResourceFS';
import useK8sWatchResourcesFS from './bridge/dynamic-plugin-sdk-mocks/useK8sWatchResourcesFS';
configure({
testIdAttribute: 'data-test-id',
});
jest.doMock('@openshift-console/dynamic-plugin-sdk', () => ({
useK8sWatchResource: jest.fn((props: WatchK8sResource | null) => {
const response = useK8sWatchResourceFS(props);
return response;
}),
useK8sWatchResources: jest.fn((props: any) => {
const response = useK8sWatchResourcesFS(props);
return response;
}),
consoleFetch: jest.fn((props: any) => {
const response = consoleFetchFS(props);
return response;
}),
}));