integration test fixes

This commit is contained in:
2025-12-23 16:32:05 -08:00
parent 921c48fc57
commit ae7afaaf97
11 changed files with 52 additions and 46 deletions

View File

@@ -86,12 +86,15 @@ describe('AI Routes (/api/ai)', () => {
// Arrange
const mkdirError = new Error('EACCES: permission denied');
vi.resetModules(); // Reset modules to re-run top-level code
vi.doMock('node:fs', () => ({
...fs,
mkdirSync: vi.fn().mockImplementation(() => {
throw mkdirError;
}),
}));
vi.doMock('node:fs', () => {
const mockFs = {
...fs,
mkdirSync: vi.fn().mockImplementation(() => {
throw mkdirError;
}),
};
return { ...mockFs, default: mockFs };
});
const { logger } = await import('../services/logger.server');
// Act: Dynamically import the router to trigger the mkdirSync call

View File

@@ -381,7 +381,7 @@ router.post('/logout', async (req: Request, res: Response) => {
// Instruct the browser to clear the cookie by setting its expiration to the past.
res.cookie('refreshToken', '', {
httpOnly: true,
expires: new Date(0),
maxAge: 0, // Use maxAge for modern compatibility; Express sets 'Expires' as a fallback.
secure: process.env.NODE_ENV === 'production',
});
res.status(200).json({ message: 'Logged out successfully.' });