fix issues in core
This commit is contained in:
@@ -1,36 +1,13 @@
|
||||
import { describe, it, expect, vi, type Mock } from 'vitest';
|
||||
import { GetAnalyticsMetricsUseCase, type GetAnalyticsMetricsInput, type GetAnalyticsMetricsOutput } from './GetAnalyticsMetricsUseCase';
|
||||
import type { IPageViewRepository } from '../../domain/repositories/IPageViewRepository';
|
||||
import type { Logger, UseCaseOutputPort } from '@core/shared/application';
|
||||
import { Result } from '@core/shared/application/Result';
|
||||
|
||||
describe('GetAnalyticsMetricsUseCase', () => {
|
||||
let pageViewRepository: {
|
||||
save: Mock;
|
||||
findById: Mock;
|
||||
findByEntityId: Mock;
|
||||
findBySessionId: Mock;
|
||||
countByEntityId: Mock;
|
||||
getUniqueVisitorsCount: Mock;
|
||||
getAverageSessionDuration: Mock;
|
||||
getBounceRate: Mock;
|
||||
};
|
||||
let logger: Logger;
|
||||
let output: UseCaseOutputPort<GetAnalyticsMetricsOutput> & { present: Mock };
|
||||
let useCase: GetAnalyticsMetricsUseCase;
|
||||
|
||||
beforeEach(() => {
|
||||
pageViewRepository = {
|
||||
save: vi.fn(),
|
||||
findById: vi.fn(),
|
||||
findByEntityId: vi.fn(),
|
||||
findBySessionId: vi.fn(),
|
||||
countByEntityId: vi.fn(),
|
||||
getUniqueVisitorsCount: vi.fn(),
|
||||
getAverageSessionDuration: vi.fn(),
|
||||
getBounceRate: vi.fn(),
|
||||
} as unknown as IPageViewRepository as any;
|
||||
|
||||
logger = {
|
||||
debug: vi.fn(),
|
||||
info: vi.fn(),
|
||||
@@ -43,7 +20,6 @@ describe('GetAnalyticsMetricsUseCase', () => {
|
||||
};
|
||||
|
||||
useCase = new GetAnalyticsMetricsUseCase(
|
||||
pageViewRepository as unknown as IPageViewRepository,
|
||||
logger,
|
||||
output,
|
||||
);
|
||||
@@ -78,4 +54,4 @@ describe('GetAnalyticsMetricsUseCase', () => {
|
||||
expect(result.isErr()).toBe(true);
|
||||
expect((logger.error as unknown as Mock)).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user