agenda-redirect.test.ts553 BView on GitHub import { redirect } from 'react-router';
jest.mock('react-router', () => ({
...jest.requireActual('react-router'),
redirect: jest.fn((to: string) => ({ to })),
}));
import { clientLoader } from '@/app/(routes)/mail/agenda/page';
describe('agenda route redirect', () => {
it('redirects legacy /mail/agenda to /agenda', () => {
let thrown: unknown;
try {
clientLoader();
} catch (error) {
thrown = error;
}
expect(thrown).toEqual({ to: '/agenda' });
expect(redirect).toHaveBeenCalledWith('/agenda');
});
});