-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathmy-array_test.js
57 lines (52 loc) · 1.11 KB
/
my-array_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 { MyArray } from '../lib/my-array.js';
let expect = require('chai').expect;
describe('Array.zip tests', () => {
let combiner = (bookmark, boxart) => {
return {
time: bookmark.time,
boxart: boxart.url
};
};
let tests = function *() {
yield {
bookmarks: [
{
videoId: 65432445,
time: 32432
}
],
boxarts: [
{
videoId: 65432445,
width: 130,
height:200,
url:'http://cdn-0.nflximg.com/images/2891/TheChamber130.jpg'
}
],
combiner,
result: '[{"time":32432,' +
'"boxart":"http://cdn-0.nflximg.com/images/2891/TheChamber130.jpg"}]'
};
yield {
bookmarks: [
{
videoId: 65432445,
time: 32432
}
],
boxarts: [],
combiner,
result: '[]'
};
};
it('should return correct result', () => {
for (let test of tests()) {
expect(JSON.stringify(new MyArray().zip(
test.combiner,
test.bookmarks,
test.boxarts)))
.to.equal(test.result);
}
});
});