implement counting for feed Repository
This commit is contained in:
@ -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);
|
||||
});
|
||||
});
|
||||
});
|
@ -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();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user