jest.setup.ts 610 B

123456789101112131415161718192021222324
  1. // Learn more: https://github.com/testing-library/jest-dom
  2. import "@testing-library/jest-dom";
  3. global.fetch = jest.fn(() =>
  4. Promise.resolve({
  5. ok: true,
  6. status: 200,
  7. json: () => Promise.resolve({}),
  8. headers: new Headers(),
  9. redirected: false,
  10. statusText: "OK",
  11. type: "basic",
  12. url: "",
  13. clone: function () {
  14. return this;
  15. },
  16. body: null,
  17. bodyUsed: false,
  18. arrayBuffer: () => Promise.resolve(new ArrayBuffer(0)),
  19. blob: () => Promise.resolve(new Blob()),
  20. formData: () => Promise.resolve(new FormData()),
  21. text: () => Promise.resolve(""),
  22. }),
  23. );