Skip to content

Commit 362b178

Browse files
committed
test: add basic tests for cinemas
1 parent 0de1a31 commit 362b178

File tree

3 files changed

+29
-0
lines changed

3 files changed

+29
-0
lines changed

tests/cinema.service.test.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import { describe, expect, test } from 'vitest';
2+
import { CSFDCinema } from '../src/interfaces/cinema.interface';
3+
import { CinemaScraper } from '../src/services/cinema.service';
4+
5+
const DISTRICT = 1;
6+
const PERIOD = 'today';
7+
8+
describe('CinemaScraper', () => {
9+
test('Should have specific props', async () => {
10+
const scraper = new CinemaScraper();
11+
const cinemas: CSFDCinema[] = await scraper.cinemas();
12+
13+
expect(Array.isArray(cinemas)).toBe(true);
14+
expect(cinemas.length).toBe(27);
15+
expect(cinemas[0].city).toBe('Praha');
16+
expect(cinemas[0].coords).toStrictEqual({ lat: 50.0711592, lng: 14.4015589 });
17+
expect(cinemas[0].id).toBe(110);
18+
expect(cinemas[0].name).toBe('CineStar Praha');
19+
expect(cinemas[0].screenings[0].date).toContain('pátek');
20+
expect(cinemas[0].url).toBe('http://www.cinestar.cz/cz/praha5/domu');
21+
});
22+
23+
test('Should fetch cinemas for specific district and period', async () => {
24+
const scraper = new CinemaScraper();
25+
const cinemas: CSFDCinema[] = await scraper.cinemas(DISTRICT, PERIOD);
26+
expect(Array.isArray(cinemas)).toBe(true);
27+
expect(cinemas.length).toBeGreaterThan(0);
28+
});
29+
});
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)