implement counting for feed Repository

This commit is contained in:
albert
2025-07-29 01:02:35 +02:00
parent 987b0aed3e
commit 26e8b83c87
2 changed files with 13 additions and 0 deletions

View File

@ -38,5 +38,14 @@ describe('ScrapingService', () => {
const hasRepository = scrapingService.hasRepository();
expect(hasRepository).toBe(true);
});
test('should get feed count from repository', async () => {
mockFeedRepository.count.mockResolvedValue(5);
const count = await scrapingService.getFeedCount();
expect(mockFeedRepository.count).toHaveBeenCalled();
expect(count).toBe(5);
});
});
});

View File

@ -10,4 +10,8 @@ export class ScrapingService {
hasRepository(): boolean {
return this.feedRepository !== null && this.feedRepository !== undefined;
}
async getFeedCount(): Promise<number> {
return await this.feedRepository.count();
}
}