chore(screener): add @xyflow/react + vitest test environment
This commit is contained in:
34
src/test-setup.js
Normal file
34
src/test-setup.js
Normal file
@@ -0,0 +1,34 @@
|
||||
import '@testing-library/jest-dom/vitest';
|
||||
|
||||
// jsdom polyfills for react-flow
|
||||
if (typeof window !== 'undefined') {
|
||||
if (!window.matchMedia) {
|
||||
window.matchMedia = (query) => ({
|
||||
matches: false,
|
||||
media: query,
|
||||
onchange: null,
|
||||
addEventListener: () => {},
|
||||
removeEventListener: () => {},
|
||||
addListener: () => {},
|
||||
removeListener: () => {},
|
||||
dispatchEvent: () => false,
|
||||
});
|
||||
}
|
||||
if (!window.ResizeObserver) {
|
||||
window.ResizeObserver = class {
|
||||
observe() {}
|
||||
unobserve() {}
|
||||
disconnect() {}
|
||||
};
|
||||
}
|
||||
if (!window.DOMMatrixReadOnly) {
|
||||
window.DOMMatrixReadOnly = class {
|
||||
constructor() {}
|
||||
m22 = 1;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
beforeEach(() => {
|
||||
localStorage.clear();
|
||||
});
|
||||
Reference in New Issue
Block a user