setupTests.ts 467 B

12345678910111213141516171819
  1. // jest-dom adds custom jest matchers for asserting on DOM nodes.
  2. // allows you to do things like:
  3. // expect(element).toHaveTextContent(/react/i)
  4. // learn more: https://github.com/testing-library/jest-dom
  5. import '@testing-library/jest-dom';
  6. import nock from 'nock';
  7. beforeEach(() => {
  8. jest.restoreAllMocks();
  9. });
  10. beforeAll(() => {
  11. nock.disableNetConnect();
  12. nock.enableNetConnect('http://my-api.url:1234');
  13. });
  14. afterAll(() => {
  15. nock.enableNetConnect();
  16. });