refactor use cases
This commit is contained in:
@@ -1,10 +1,9 @@
|
||||
import { describe, it, expect, vi, type Mock } from 'vitest';
|
||||
import { GetDashboardDataUseCase, type GetDashboardDataOutput } from './GetDashboardDataUseCase';
|
||||
import type { Logger, UseCaseOutputPort } from '@core/shared/application';
|
||||
import { GetDashboardDataUseCase } from './GetDashboardDataUseCase';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
|
||||
describe('GetDashboardDataUseCase', () => {
|
||||
let logger: Logger;
|
||||
let output: UseCaseOutputPort<GetDashboardDataOutput> & { present: Mock };
|
||||
let useCase: GetDashboardDataUseCase;
|
||||
|
||||
beforeEach(() => {
|
||||
@@ -15,18 +14,15 @@ describe('GetDashboardDataUseCase', () => {
|
||||
error: vi.fn(),
|
||||
} as unknown as Logger;
|
||||
|
||||
output = {
|
||||
present: vi.fn(),
|
||||
};
|
||||
|
||||
useCase = new GetDashboardDataUseCase(logger, output);
|
||||
useCase = new GetDashboardDataUseCase(logger);
|
||||
});
|
||||
|
||||
it('presents placeholder dashboard metrics and logs retrieval', async () => {
|
||||
it('returns placeholder dashboard metrics and logs retrieval', async () => {
|
||||
const result = await useCase.execute();
|
||||
|
||||
expect(result.isOk()).toBe(true);
|
||||
expect(output.present).toHaveBeenCalledWith({
|
||||
const data = result.unwrap();
|
||||
expect(data).toEqual({
|
||||
totalUsers: 0,
|
||||
activeUsers: 0,
|
||||
totalRaces: 0,
|
||||
|
||||
Reference in New Issue
Block a user