Skip to content

Commit

Permalink
chore: improve /base test code
Browse files Browse the repository at this point in the history
  • Loading branch information
work-kevin-flynn committed Nov 26, 2024
1 parent 97ebe21 commit b33a90b
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions packages/base/src/__tests__/enhancedLocalStorageInWindow.test.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
const originalConsoleLog = console.log;
beforeEach(() => {
vi.spyOn(console, 'log');
(global as any).window = {};
});
afterEach(() => {
vi.unmock('console.log');
delete (global as any).window;
});

describe('localStorageMock in window', () => {
beforeEach(() => {
console.log = vi.fn();
(global as any).window = {};
});
afterEach(() => {
console.log = originalConsoleLog;
delete (global as any).window;
});

it('enhancedLocalStorage should be set to localStorage in browser environment', async () => {
await import('../enhancedLocalStorage');
expect(console.log).toHaveBeenCalledWith('enhancedLocalStorage in window');
Expand Down

0 comments on commit b33a90b

Please sign in to comment.