ChatGPT-Next-Web/jest.setup.ts

25 lines
610 B
TypeScript
Raw Normal View History

2024-08-06 18:03:27 +08:00
// Learn more: https://github.com/testing-library/jest-dom
import "@testing-library/jest-dom";
2024-10-28 16:47:05 +08:00
global.fetch = jest.fn(() =>
Promise.resolve({
ok: true,
status: 200,
json: () => Promise.resolve({}),
headers: new Headers(),
redirected: false,
statusText: "OK",
type: "basic",
url: "",
clone: function () {
return this;
},
body: null,
bodyUsed: false,
arrayBuffer: () => Promise.resolve(new ArrayBuffer(0)),
blob: () => Promise.resolve(new Blob()),
formData: () => Promise.resolve(new FormData()),
text: () => Promise.resolve(""),
}),
);