File size: 532 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
import * as nock from 'nock';
// Disables all network requests for all tests.
nock.disableNetConnect();
beforeAll( () => {
// reactivate nock on test start
if ( ! nock.isActive() ) {
nock.activate();
}
} );
afterAll( () => {
// helps clean up nock after each test run and avoid memory leaks
nock.restore();
nock.cleanAll();
} );
// Don't need to mock specific functions for any tests, but mocking
// module because it accesses the `document` global.
jest.mock( 'wpcom-proxy-request', () => ( {
__esModule: true,
} ) );
|