Skip to content

Commit c3a22a2

Browse files
Fix window.test.js test failures due to mock leaks
1 parent d9cbb3c commit c3a22a2

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

tests/window.test.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { describe, it, expect, vi, beforeEach } from 'vitest';
1+
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
22
import { WindowWrapper } from '../lib/window.js';
33

44
describe('WindowWrapper', () => {
@@ -121,6 +121,14 @@ describe('WindowWrapper', () => {
121121
});
122122

123123
describe('_pendingLaters tracking', () => {
124+
let originalGetLaters;
125+
beforeEach(() => {
126+
originalGetLaters = global.compositor.get_laters;
127+
});
128+
afterEach(() => {
129+
global.compositor.get_laters = originalGetLaters;
130+
});
131+
124132
it('should track and remove compositor laters on destroy', () => {
125133
const wrapper = new WindowWrapper(mockWindow, mockController);
126134
const mockLaters = { add: vi.fn(() => 42), remove: vi.fn() };

0 commit comments

Comments
 (0)