-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetupTests.js
More file actions
30 lines (23 loc) · 734 Bytes
/
setupTests.js
File metadata and controls
30 lines (23 loc) · 734 Bytes
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
import '@testing-library/jest-dom';
import { server } from './mocks/server';
class ResizeObserver {
disconnect() {}
observe() {}
unobserve() {}
}
window.ResizeObserver = ResizeObserver;
jest.mock('@ably/ui/core/utils/syntax-highlighter', () => ({
highlightSnippet: jest.fn,
registerDefaultLanguages: jest.fn,
}));
jest.mock('@ably/ui/core/utils/syntax-highlighter-registry', () => ({
__esModule: true,
default: [],
}));
// Establish API mocking before all tests.
beforeAll(() => server.listen());
// Reset any request handlers that we may add during the tests,
// so they don't affect other tests.
afterEach(() => server.resetHandlers());
// Clean up after the tests are finished.
afterAll(() => server.close());