imageFilenames and imageFilename, backend integration tests, frontend tests, removed username references
This commit is contained in:
@@ -3,3 +3,53 @@
|
||||
// expect(element).toHaveTextContent(/react/i)
|
||||
// learn more: https://github.com/testing-library/jest-dom
|
||||
import '@testing-library/jest-dom';
|
||||
|
||||
// Mock window.location for tests that use navigation
|
||||
const mockLocation = {
|
||||
...window.location,
|
||||
href: 'http://localhost:3000',
|
||||
pathname: '/',
|
||||
assign: jest.fn(),
|
||||
replace: jest.fn(),
|
||||
reload: jest.fn(),
|
||||
};
|
||||
|
||||
Object.defineProperty(window, 'location', {
|
||||
value: mockLocation,
|
||||
writable: true,
|
||||
});
|
||||
|
||||
// Suppress console errors during tests (optional, comment out for debugging)
|
||||
const originalConsoleError = console.error;
|
||||
const originalConsoleWarn = console.warn;
|
||||
|
||||
beforeAll(() => {
|
||||
console.error = (...args: any[]) => {
|
||||
// Filter out known React warnings during tests
|
||||
if (
|
||||
typeof args[0] === 'string' &&
|
||||
(args[0].includes('Warning: ReactDOM.render is no longer supported') ||
|
||||
args[0].includes('Warning: An update to') ||
|
||||
args[0].includes('act(...)'))
|
||||
) {
|
||||
return;
|
||||
}
|
||||
originalConsoleError.call(console, ...args);
|
||||
};
|
||||
|
||||
console.warn = (...args: any[]) => {
|
||||
// Filter out known warnings
|
||||
if (
|
||||
typeof args[0] === 'string' &&
|
||||
args[0].includes('componentWillReceiveProps')
|
||||
) {
|
||||
return;
|
||||
}
|
||||
originalConsoleWarn.call(console, ...args);
|
||||
};
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
console.error = originalConsoleError;
|
||||
console.warn = originalConsoleWarn;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user