updated the test
This commit is contained in:
18
tests/setup/jest.setup.cjs
Normal file
18
tests/setup/jest.setup.cjs
Normal file
@@ -0,0 +1,18 @@
|
||||
require('@testing-library/jest-dom');
|
||||
|
||||
/**
|
||||
* The `import.meta.env` stand-in (see babel-plugin-import-meta.cjs).
|
||||
*
|
||||
* Defaults to production-shaped values — no VITE_ overrides, DEV false — so a
|
||||
* module that branches on an override only does so in the test that asks for
|
||||
* it. Reset before every test so one test's override cannot leak into the next.
|
||||
*/
|
||||
const defaultImportMeta = () => ({ env: { DEV: false, PROD: true, MODE: 'test' } });
|
||||
|
||||
globalThis.__VITE_IMPORT_META__ = defaultImportMeta();
|
||||
|
||||
beforeEach(() => {
|
||||
globalThis.__VITE_IMPORT_META__ = defaultImportMeta();
|
||||
localStorage.clear();
|
||||
jest.clearAllMocks();
|
||||
});
|
||||
Reference in New Issue
Block a user