Mechanical reformat — no logic changes. 398 files changed, 19125 insertions(+), 16457 deletions(-). Prettier 3.8.4 with .prettierrc (singleQuote:true, semi:true, tabWidth:2, trailingComma:all, printWidth:100). Isolated per D-13-08 for reviewability.
33 lines
1.1 KiB
TypeScript
33 lines
1.1 KiB
TypeScript
/**
|
|
* Vitest global test setup for apps/pwa.
|
|
*
|
|
* This file runs before each test file, before module imports that trigger
|
|
* module-level side effects (e.g. Zustand store initialisation calls
|
|
* window.matchMedia at create() time).
|
|
*
|
|
* Polyfills required for jsdom:
|
|
* - window.matchMedia: used by calendarStore to resolve the default view
|
|
* from viewport width at store initialisation time.
|
|
*/
|
|
|
|
// Extend Vitest's expect with jest-dom matchers (toHaveTextContent, etc.)
|
|
import '@testing-library/jest-dom';
|
|
|
|
// Polyfill window.matchMedia for jsdom.
|
|
// jsdom does not implement the CSSOM MediaQueryList API.
|
|
// calendarStore.ts calls window.matchMedia during Zustand create(), so this
|
|
// must be set before the store module is imported in any test.
|
|
Object.defineProperty(window, 'matchMedia', {
|
|
writable: true,
|
|
value: (query: string) => ({
|
|
matches: false, // tablet-desktop default — week-start-day tests are unaffected
|
|
media: query,
|
|
onchange: null,
|
|
addListener: () => undefined,
|
|
removeListener: () => undefined,
|
|
addEventListener: () => undefined,
|
|
removeEventListener: () => undefined,
|
|
dispatchEvent: () => false,
|
|
}),
|
|
});
|