seed data

This commit is contained in:
2025-12-26 23:53:47 +01:00
parent 64661d903e
commit b68405aa46
9 changed files with 289 additions and 48 deletions

View File

@@ -80,7 +80,7 @@ describe('AuthController', () => {
});
describe('getSession', () => {
it('should call service.getCurrentSession and return session DTO', async () => {
it('should call service.getCurrentSession and write JSON response', async () => {
const session: AuthSessionDTO = {
token: 'token123',
user: {
@@ -91,18 +91,23 @@ describe('AuthController', () => {
};
(service.getCurrentSession as Mock).mockResolvedValue(session);
const result = await controller.getSession();
const res = { json: vi.fn() } as any;
await controller.getSession(res);
expect(service.getCurrentSession).toHaveBeenCalled();
expect(result).toEqual(session);
expect(res.json).toHaveBeenCalledWith(session);
});
it('should return null if no session', async () => {
it('should write JSON null when no session', async () => {
(service.getCurrentSession as Mock).mockResolvedValue(null);
const result = await controller.getSession();
const res = { json: vi.fn() } as any;
expect(result).toBeNull();
await controller.getSession(res);
expect(service.getCurrentSession).toHaveBeenCalled();
expect(res.json).toHaveBeenCalledWith(null);
});
});