-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
65 lines (59 loc) · 2.25 KB
/
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
58
59
60
61
62
63
64
65
require('./src/set-require-base-to-project-root');
const assert = require('assert');
const getId = require('src/get-id');
const urls = [
'http://www.youtube-nocookie.com/embed/up_lNV-yoK4?rel=0',
'http://www.youtube.com/user/Scobleizer#p/u/1/1p3vcRhsYGo',
'http://www.youtube.com/watch?v=cKZDdG9FTKY&feature=channel',
'http://www.youtube.com/watch?v=yZ-K7nCVnBI&playnext_from=TL&videos=osPknwzXEas&feature=sub',
'http://www.youtube.com/ytscreeningroom?v=NRHVzbJVx8I',
'http://www.youtube.com/user/SilkRoadTheatre#p/a/u/2/6dwqZw0j_jY',
'http://youtu.be/6dwqZw0j_jY',
'http://www.youtube.com/watch?v=6dwqZw0j_jY&feature=youtu.be',
'http://youtu.be/afa-5HQHiAs',
'http://www.youtube.com/user/Scobleizer#p/u/1/1p3vcRhsYGo?rel=0',
'http://www.youtube.com/watch?v=cKZDdG9FTKY&feature=channel',
'http://www.youtube.com/watch?v=yZ-K7nCVnBI&playnext_from=TL&videos=osPknwzXEas&feature=sub',
'http://www.youtube.com/ytscreeningroom?v=NRHVzbJVx8I',
'http://www.youtube.com/embed/nas1rJpm7wY?rel=0',
'http://www.youtube.com/watch?v=peFZbP64dsU',
'http://youtube.com/v/dQw4w9WgXcQ?feature=youtube_gdata_player',
'http://youtube.com/vi/dQw4w9WgXcQ?feature=youtube_gdata_player',
'http://youtube.com/?v=dQw4w9WgXcQ&feature=youtube_gdata_player',
'http://www.youtube.com/watch?v=dQw4w9WgXcQ&feature=youtube_gdata_player',
'http://youtube.com/?vi=dQw4w9WgXcQ&feature=youtube_gdata_player',
'http://youtube.com/watch?v=dQw4w9WgXcQ&feature=youtube_gdata_player',
'http://youtube.com/watch?vi=dQw4w9WgXcQ&feature=youtube_gdata_player',
'http://youtu.be/dQw4w9WgXcQ?feature=youtube_gdata_player'
];
const expectedResults = [
'up_lNV-yoK4',
'1p3vcRhsYGo',
'cKZDdG9FTKY',
'yZ-K7nCVnBI',
'NRHVzbJVx8I',
'6dwqZw0j_jY',
'6dwqZw0j_jY',
'6dwqZw0j_jY',
'afa-5HQHiAs',
'1p3vcRhsYGo',
'cKZDdG9FTKY',
'yZ-K7nCVnBI',
'NRHVzbJVx8I',
'nas1rJpm7wY',
'peFZbP64dsU',
'dQw4w9WgXcQ',
'dQw4w9WgXcQ',
'dQw4w9WgXcQ',
'dQw4w9WgXcQ',
'dQw4w9WgXcQ',
'dQw4w9WgXcQ',
'dQw4w9WgXcQ',
'dQw4w9WgXcQ',
];
describe('getId', () => {
it('should get the ids from each of the test YouTube links', () => {
const ids = urls.map(getId);
assert.deepEqual(ids, expectedResults, 'Incorrect id returned.');
})
})