forked from vankasteelj/opensubtitles-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tests.js
40 lines (36 loc) · 858 Bytes
/
tests.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
const OS = require('./index.js');
const UA = 'TemporaryUserAgent';
const imdb = '0898266', show = 'The Big Bang Theory', s = '01', ep = '01';
let os, test;
test = 'http client';
os = new OS({
useragent: UA,
ssl: false
});
console.time(test);
os.api.ServerInfo().then(() => {
console.timeEnd(test);
test = 'https client';
os = new OS({
useragent: UA,
ssl: true
});
console.time(test);
return os.api.ServerInfo();
}).then(() => {
console.timeEnd(test);
test = 'search';
console.time(test);
return os.search({
season: s,
episode: ep,
imdbid: imdb,
limit: 'all'
});
}).then(() => {
console.timeEnd(test);
console.log('Passed test.');
}).catch((err) => {
console.log('Test failed');
console.log(err);
});