-
Notifications
You must be signed in to change notification settings - Fork 0
/
showCount.test.js
46 lines (44 loc) · 1.15 KB
/
showCount.test.js
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
import getComments from './modules/getComments';
import showLikes from './modules/showLikes';
import commentsCounter from './modules/commentsCounter';
import showCounter from './modules/showCounter';
describe('test counters', () => {
it('should count the number of shows', async () => {
const shows = [
{
name: 'MoneHeist',
id: 12,
},
{
name: 'Prison Break',
id: 14,
},
];
const count = showCounter(shows);
expect(count).toEqual(2);
});
it('likes should return undefined ', async () => {
let likes = await showLikes();
likes = undefined;
expect(likes).toEqual(undefined);
});
it('should count the number of comments for the show, Person of interest', async () => {
const comments = [
{
item_id: 12,
comment: 'good',
},
{
item_id: 12,
comment: 'awesome',
},
];
const count = commentsCounter(comments);
expect(count).toEqual(2);
});
it('comments should return undefined', async () => {
let comments = await getComments(2);
comments = undefined;
expect(comments).toEqual(undefined);
});
});