synapse-react-client
Version:
[](https://badge.fury.io/js/synapse-react-client) [](https://github.com/prettier/prettie
40 lines (39 loc) • 1.36 kB
JavaScript
import "@testing-library/jest-dom/vitest";
import "./ComponentToBePassedPropsCustomMatcher.js";
import { ResizeObserver as i } from "@juggle/resize-observer";
import "./muiDatePickerMock.js";
import { setupIntersectionMocking as n } from "react-intersection-observer/test-utils";
import "whatwg-fetch";
import { TextEncoder as t, TextDecoder as r } from "node:util";
vi.stubGlobal("jest", vi);
global.ResizeObserver = i;
if (typeof window < "u") {
window.URL.createObjectURL = vi.fn().mockReturnValue("blob:mockBlobUrlConfiguredInTestSetup"), window.URL.revokeObjectURL = vi.fn(), n(vi.fn);
const e = window.location, o = window.open;
beforeAll(() => {
delete window.location, window.location = Object.defineProperties(
{},
{
...Object.getOwnPropertyDescriptors(e),
// Each method must be manually mocked
assign: {
configurable: !0,
value: vi.fn()
},
replace: {
configurable: !0,
value: vi.fn()
},
reload: {
configurable: !0,
value: vi.fn()
}
}
), delete window.open, window.open = vi.fn();
}), afterAll(() => {
window.location = e, window.open = o;
});
}
global.TextEncoder || (global.TextEncoder = t);
global.TextDecoder || (global.TextDecoder = r);
//# sourceMappingURL=vitest.setup.js.map