Skip to content

Commit

Permalink
update: add polyfil for jest tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ayushpahwa committed Nov 21, 2024
1 parent a347807 commit 7df7f53
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions app/client/test/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ jest.mock("../src/api/Api.ts", () => ({
default: class Api { },
}));

// Polyfill for `structuredClone` if not available
// This is needed for eslint jest tests
if (typeof global.structuredClone === "undefined") {
global.structuredClone = (obj) => {
return JSON.parse(JSON.stringify(obj));
};
}

beforeAll(() => {
window.IntersectionObserver = jest
.fn()
Expand Down

0 comments on commit 7df7f53

Please sign in to comment.