mirror of
https://github.com/lordmathis/lemma.git
synced 2025-12-22 17:44:25 +00:00
Fix tests after deps update
This commit is contained in:
@@ -34,6 +34,9 @@ describe('useFileNavigation', () => {
|
|||||||
id: 1,
|
id: 1,
|
||||||
name: 'test-workspace',
|
name: 'test-workspace',
|
||||||
};
|
};
|
||||||
|
// Default mock implementations
|
||||||
|
mockLastOpenedFile.loadLastOpenedFile.mockResolvedValue(null);
|
||||||
|
mockLastOpenedFile.saveLastOpenedFile.mockResolvedValue(undefined);
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
|
|||||||
@@ -1,5 +1,26 @@
|
|||||||
import '@testing-library/jest-dom';
|
import '@testing-library/jest-dom';
|
||||||
import { vi } from 'vitest';
|
import { vi, beforeAll, afterAll } from 'vitest';
|
||||||
|
|
||||||
|
// Suppress console errors during tests
|
||||||
|
const originalConsoleError = console.error;
|
||||||
|
beforeAll(() => {
|
||||||
|
console.error = (...args: any[]) => {
|
||||||
|
// Suppress specific expected errors during tests
|
||||||
|
const errorString = args.join(' ');
|
||||||
|
if (
|
||||||
|
errorString.includes('Failed to initialize auth') ||
|
||||||
|
errorString.includes('Failed to save last opened file') ||
|
||||||
|
errorString.includes('Failed to load last opened file')
|
||||||
|
) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
originalConsoleError(...args);
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(() => {
|
||||||
|
console.error = originalConsoleError;
|
||||||
|
});
|
||||||
|
|
||||||
// Mock window.API_BASE_URL
|
// Mock window.API_BASE_URL
|
||||||
Object.defineProperty(window, 'API_BASE_URL', {
|
Object.defineProperty(window, 'API_BASE_URL', {
|
||||||
@@ -23,8 +44,8 @@ Object.defineProperty(window, 'matchMedia', {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Mock ResizeObserver - sometimes needed for Mantine components
|
// Mock ResizeObserver - sometimes needed for Mantine components
|
||||||
global.ResizeObserver = vi.fn().mockImplementation(() => ({
|
global.ResizeObserver = class ResizeObserver {
|
||||||
observe: vi.fn(),
|
observe = vi.fn();
|
||||||
unobserve: vi.fn(),
|
unobserve = vi.fn();
|
||||||
disconnect: vi.fn(),
|
disconnect = vi.fn();
|
||||||
}));
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user