-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy patharrays-to-tree_test.js
57 lines (51 loc) · 2.14 KB
/
arrays-to-tree_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
47
48
49
50
51
52
53
54
55
56
57
'use strict';
import { movieLists } from '../lib/arrays-to-tree.js';
let expect = require('chai').expect;
describe('Movie lists tests', () => {
let newRelease1;
let newRelease2;
let thriller1;
let thriller2;
it('should have 2 lists "New Releases" and "Thrillers"', () => {
expect(Array.isArray(movieLists)).to.equal(true);
expect(movieLists.length).to.equal(2);
expect(movieLists[0]).to.be.a('object');
expect(movieLists[0].name).to.equal('New Releases');
expect(movieLists[1]).to.be.a('object');
expect(movieLists[1].name).to.equal('Thrillers');
});
it ('should have 2 videos in each list', () => {
expect(Array.isArray(movieLists[0].videos)).to.equal(true);
expect(movieLists[0].videos.length).to.equal(2);
newRelease1 = movieLists[0].videos[0];
newRelease2 = movieLists[0].videos[1];
expect(Array.isArray(movieLists[1].videos)).to.equal(true);
expect(movieLists[1].videos.length).to.equal(2);
thriller1 = movieLists[1].videos[0];
thriller2 = movieLists[1].videos[1];
});
it ('should have correct id and title for each video', () => {
expect(newRelease1.id).to.equal(65432445);
expect(newRelease1.title).to.equal('The Chamber');
expect(newRelease2.id).to.equal(675465);
expect(newRelease2.title).to.equal('Fracture');
expect(thriller1.id).to.equal(70111470);
expect(thriller1.title).to.equal('Die Hard');
expect(thriller2.id).to.equal(654356453);
expect(thriller2.title).to.equal('Bad Boys');
});
it ('should have correct time and boxart for each video', () => {
expect(newRelease1.time).to.equal(32432);
expect(newRelease1.boxart).to.equal(
'http://cdn-0.nflximg.com/images/2891/TheChamber130.jpg');
expect(newRelease2.time).to.equal(3534543);
expect(newRelease2.boxart).to.equal(
'http://cdn-0.nflximg.com/images/2891/Fracture120.jpg');
expect(thriller1.time).to.equal(645243);
expect(thriller1.boxart).to.equal(
'http://cdn-0.nflximg.com/images/2891/DieHard150.jpg');
expect(thriller2.time).to.equal(984934);
expect(thriller2.boxart).to.equal(
'http://cdn-0.nflximg.com/images/2891/BadBoys140.jpg');
});
});