Files
rive-react/setupTests.ts
2021-06-04 16:43:13 +01:00

48 lines
771 B
TypeScript

import "@testing-library/jest-dom";
window.IntersectionObserver = class IntersectionObserver {
readonly root: Element | null;
readonly rootMargin: string;
readonly thresholds: ReadonlyArray<number>;
constructor() {
this.root = null;
this.rootMargin = "";
this.thresholds = [];
}
disconnect() {}
observe() {}
takeRecords(): IntersectionObserverEntry[] {
return [];
}
unobserve() {}
};
jest.mock("rive-js", () => ({
Rive: jest.fn().mockImplementation(() => ({
on: jest.fn(),
stop: jest.fn(),
})),
Layout: jest.fn(),
Fit: {
Cover: "cover",
},
Alignment: {
Center: "center",
},
EventType: {
Load: "load",
},
StateMachineInputType: {
Number: 1,
Boolean: 2,
Trigger: 3,
},
}));