test: update AgentFooter tests to use document.querySelector for spinner checks

test: mock window.matchMedia in setupTests.js for consistent test environment
This commit is contained in:
Danny Avila 2025-07-16 00:38:42 -04:00 committed by Marco Beretta
parent bac6e499b7
commit 63d0c301a0
No known key found for this signature in database
GPG key ID: D918033D8E74CC11
2 changed files with 18 additions and 3 deletions

View file

@ -20,6 +20,21 @@ import 'jest-canvas-mock';
// Mock ResizeObserver
import './resizeObserver.mock';
// Mock window.matchMedia
Object.defineProperty(window, 'matchMedia', {
writable: true,
value: jest.fn().mockImplementation((query) => ({
matches: false,
media: query,
onchange: null,
addListener: jest.fn(), // deprecated
removeListener: jest.fn(), // deprecated
addEventListener: jest.fn(),
removeEventListener: jest.fn(),
dispatchEvent: jest.fn(),
})),
});
beforeEach(() => {
jest.clearAllMocks();
});