adding first basic test ( ScrapginService)

This commit is contained in:
albert
2025-07-29 00:57:05 +02:00
parent 0d301f5c49
commit 29e7b9f8e0
2 changed files with 33 additions and 1 deletions

View File

@ -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

View 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);
});
});
});