29 lines
735 B
TypeScript
29 lines
735 B
TypeScript
import { describe, it, expect, vi, type Mock } from 'vitest';
|
|
import { LogoutUseCase } from './LogoutUseCase';
|
|
import type { IdentitySessionPort } from '../ports/IdentitySessionPort';
|
|
|
|
describe('LogoutUseCase', () => {
|
|
let sessionPort: {
|
|
clearSession: Mock;
|
|
getCurrentSession: Mock;
|
|
createSession: Mock;
|
|
};
|
|
let useCase: LogoutUseCase;
|
|
|
|
beforeEach(() => {
|
|
sessionPort = {
|
|
clearSession: vi.fn(),
|
|
getCurrentSession: vi.fn(),
|
|
createSession: vi.fn(),
|
|
};
|
|
|
|
useCase = new LogoutUseCase(sessionPort as unknown as IdentitySessionPort);
|
|
});
|
|
|
|
it('clears the current session', async () => {
|
|
await useCase.execute();
|
|
|
|
expect(sessionPort.clearSession).toHaveBeenCalledTimes(1);
|
|
});
|
|
});
|