File size: 1,811 Bytes
95f4e64
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import { getShow, search, getShows, getTorrents, getTorrentsByImdbId } from './src/main';

// ['title', 'summary', 'description', 'imdbId', 'episodes']

test('Get single show from eztv', async () => {
    const result = await getShow(481);

    expect(result).toEqual(expect.objectContaining({
        title: expect.any(String),
        summary: expect.any(String),
        description: expect.any(String),
        imdbId: expect.any(String),
        episodes: expect.any(Array),
    }));
})

test('Search for a show on eztv', async () => {
    const result = await search('game of thrones s01e01');
    
    expect(result[0]).toEqual(expect.objectContaining({
        showLink: expect.any(String),
        title: expect.any(String),
        magnet: expect.any(String),
        torrent: expect.any(String),
        size: expect.any(Number),
        released: expect.any(String),
        seeds: expect.any(Number),
    }))
})

test('Get list of shows', async () => {
    const result = await getShows();
    
    expect(result[0]).toEqual(expect.objectContaining({
        id: expect.any(Number),
        title: expect.any(String),
    }))
})

test('Get list of torrents', async () => {
    const result = await getTorrents();
    
    expect(result).toEqual(expect.objectContaining({
        torrents_count: expect.any(Number),
        limit: expect.any(Number),
        page: expect.any(Number),
        torrents: expect.any(Array)
    }))
})

test('Get list of torrents by IMDb ID', async () => {
    const result = await getTorrentsByImdbId('tt6048596');
    
    expect(result).toEqual(expect.objectContaining({
        imdb_id: expect.anything(),
        torrents_count: expect.any(Number),
        limit: expect.any(Number),
        page: expect.any(Number),
        torrents: expect.any(Array)
    }))
})