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, } ) );