Repository navigation
Expand file tree
/
Copy pathtest.js
More file actions
56 lines (50 loc) · 1.28 KB
/
Copy pathtest.js
File metadata and controls
56 lines (50 loc) · 1.28 KB
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
const melon = require('./index');
test('Should obtain 50 songs from daily chart', async () => {
const data = await melon.parse({
limit: 50,
type: 'daily',
genre: 'KPOP',
year: new Date().getFullYear(),
month: new Date().getMonth()+1,
term: ''
});
expect(Array.isArray(data)).toBe(true);
expect(data).toHaveLength(50);
expect(data[0]).toMatchObject({
rank: 1,
trackName: expect.any(String),
artistName: expect.any(String),
album: expect.any(String),
});
});
test('Should obtain 10 songs by OST genre', async () => {
const data = await melon.parse({
limit: 10,
type: 'genre',
genre: 'DP0300',
});
expect(Array.isArray(data)).toBe(true);
expect(data).toHaveLength(10);
expect(data[0]).toMatchObject({
rank: 1,
trackName: expect.any(String),
artistName: expect.any(String),
album: expect.any(String),
});
});
test('Should obtain 10 songs from year chart', async () => {
const data = await melon.parse({
limit: 10,
type: 'year',
genre: 'KPOP',
year: 2015
});
expect(Array.isArray(data)).toBe(true);
expect(data).toHaveLength(10);
expect(data[0]).toMatchObject({
rank: 1,
trackName: expect.any(String),
artistName: expect.any(String),
album: expect.any(String),
});
});