Files
pleno-vue/tests/unit/setup.js
T
Jeppe Bundgaard b39b458f4f Add .prettierrc.json and refactor test files for improved formatting consistency:
- Introduced `.prettierrc.json` to enforce consistent code formatting across the project.
- Updated unit and e2e test files to address formatting issues, improve readability, and ensure alignment with the new Prettier configuration.
2026-04-13 09:13:27 +02:00

50 lines
897 B
JavaScript

const storage = new Map();
const localStorageMock = {
getItem(key) {
return storage.has(key) ? storage.get(key) : null;
},
setItem(key, value) {
storage.set(key, String(value));
},
removeItem(key) {
storage.delete(key);
},
clear() {
storage.clear();
},
};
if (!globalThis.localStorage) {
globalThis.localStorage = localStorageMock;
}
if (!globalThis.window) {
globalThis.window = globalThis;
}
if (!globalThis.self) {
globalThis.self = globalThis;
}
if (!globalThis.window.alert) {
globalThis.window.alert = () => {};
}
if (!globalThis.window.open) {
globalThis.window.open = () => {};
}
if (!globalThis.window.matchMedia) {
globalThis.window.matchMedia = () => ({
matches: false,
addListener() {},
removeListener() {},
addEventListener() {},
removeEventListener() {},
dispatchEvent() {
return false;
},
});
}