adding first basic test ( ScrapginService)
This commit is contained in:
@ -53,7 +53,7 @@
|
||||
|
||||
- Fourth part: [#6 PR : feat/scraper](https://github.com/aabril/dailytrends/pull/6)
|
||||
- Crea un “servicio de lectura de feeds” que extraiga por web scraping
|
||||
-
|
||||
- we are going to be implementing a Factory for the scraper, since we are going to input values and then will build our custom class
|
||||
|
||||
## Feed layer abstractions
|
||||
|
||||
|
32
src/__tests__/ScrapingService.test.ts
Normal file
32
src/__tests__/ScrapingService.test.ts
Normal file
@ -0,0 +1,32 @@
|
||||
import { ScrapingService } from '../services/ScrapingService';
|
||||
import { IFeedRepository } from '../repositories/FeedRepository';
|
||||
|
||||
// Mock FeedRepository
|
||||
const mockFeedRepository: jest.Mocked<IFeedRepository> = {
|
||||
create: jest.fn(),
|
||||
findAll: jest.fn(),
|
||||
findById: jest.fn(),
|
||||
findByUrl: jest.fn(),
|
||||
findBySource: jest.fn(),
|
||||
findTodaysFrontPage: jest.fn(),
|
||||
update: jest.fn(),
|
||||
delete: jest.fn(),
|
||||
deleteMany: jest.fn(),
|
||||
count: jest.fn(),
|
||||
exists: jest.fn()
|
||||
};
|
||||
|
||||
describe('ScrapingService', () => {
|
||||
let scrapingService: ScrapingService;
|
||||
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks();
|
||||
scrapingService = new ScrapingService(mockFeedRepository);
|
||||
});
|
||||
|
||||
describe('Basic Functionality', () => {
|
||||
test('should create ScrapingService instance', () => {
|
||||
expect(scrapingService).toBeInstanceOf(ScrapingService);
|
||||
});
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user