website refactor
This commit is contained in:
@@ -10,8 +10,8 @@ import { RatingDimensionKey } from '../../domain/value-objects/RatingDimensionKe
|
||||
import { RatingDelta } from '../../domain/value-objects/RatingDelta';
|
||||
|
||||
describe('RecomputeUserRatingSnapshotUseCase', () => {
|
||||
let mockEventRepo: Partial<IRatingEventRepository>;
|
||||
let mockRatingRepo: Partial<IUserRatingRepository>;
|
||||
let mockEventRepo: Partial<RatingEventRepository>;
|
||||
let mockRatingRepo: Partial<UserRatingRepository>;
|
||||
|
||||
beforeEach(() => {
|
||||
mockEventRepo = {
|
||||
@@ -25,16 +25,16 @@ describe('RecomputeUserRatingSnapshotUseCase', () => {
|
||||
|
||||
it('should be constructed with repositories', () => {
|
||||
const useCase = new RecomputeUserRatingSnapshotUseCase(
|
||||
mockEventRepo as IRatingEventRepository,
|
||||
mockRatingRepo as IUserRatingRepository,
|
||||
mockEventRepo as RatingEventRepository,
|
||||
mockRatingRepo as UserRatingRepository,
|
||||
);
|
||||
expect(useCase).toBeInstanceOf(RecomputeUserRatingSnapshotUseCase);
|
||||
});
|
||||
|
||||
it('should compute snapshot from empty event list', async () => {
|
||||
const useCase = new RecomputeUserRatingSnapshotUseCase(
|
||||
mockEventRepo as IRatingEventRepository,
|
||||
mockRatingRepo as IUserRatingRepository,
|
||||
mockEventRepo as RatingEventRepository,
|
||||
mockRatingRepo as UserRatingRepository,
|
||||
);
|
||||
|
||||
const result = await useCase.execute({ userId: 'user-1' });
|
||||
@@ -64,8 +64,8 @@ describe('RecomputeUserRatingSnapshotUseCase', () => {
|
||||
mockEventRepo.getAllByUserId = vi.fn().mockResolvedValue(events);
|
||||
|
||||
const useCase = new RecomputeUserRatingSnapshotUseCase(
|
||||
mockEventRepo as IRatingEventRepository,
|
||||
mockRatingRepo as IUserRatingRepository,
|
||||
mockEventRepo as RatingEventRepository,
|
||||
mockRatingRepo as UserRatingRepository,
|
||||
);
|
||||
|
||||
const result = await useCase.execute({ userId: 'user-1' });
|
||||
@@ -78,8 +78,8 @@ describe('RecomputeUserRatingSnapshotUseCase', () => {
|
||||
|
||||
it('should return proper DTO format', async () => {
|
||||
const useCase = new RecomputeUserRatingSnapshotUseCase(
|
||||
mockEventRepo as IRatingEventRepository,
|
||||
mockRatingRepo as IUserRatingRepository,
|
||||
mockEventRepo as RatingEventRepository,
|
||||
mockRatingRepo as UserRatingRepository,
|
||||
);
|
||||
|
||||
const result = await useCase.execute({ userId: 'user-1' });
|
||||
@@ -117,8 +117,8 @@ describe('RecomputeUserRatingSnapshotUseCase', () => {
|
||||
mockRatingRepo.save = vi.fn().mockResolvedValue(updated);
|
||||
|
||||
const useCase = new RecomputeUserRatingSnapshotUseCase(
|
||||
mockEventRepo as IRatingEventRepository,
|
||||
mockRatingRepo as IUserRatingRepository,
|
||||
mockEventRepo as RatingEventRepository,
|
||||
mockRatingRepo as UserRatingRepository,
|
||||
);
|
||||
|
||||
const result = await useCase.execute({ userId: 'user-1' });
|
||||
|
||||
Reference in New Issue
Block a user