-
Notifications
You must be signed in to change notification settings - Fork 73
/
tiktok.test.js
48 lines (44 loc) · 1.07 KB
/
tiktok.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
const TikTok = require('./tiktok');
const UrlParser = require('../urlParser');
const {
testUrls,
} = require('../testUrls');
function newParser() {
const parser = new UrlParser();
parser.bind(new TikTok());
return parser;
}
test('TikTok: undefined', () => {
expect(newParser().parse('https://www.tiktok.com')).toBe(undefined);
expect(newParser().parse('https://www.tiktok.com/@asd/video/123')).toBe(undefined);
expect(newParser().create({
videoInfo: {
provider: 'tiktok',
},
})).toBe(undefined);
expect(newParser().create({
videoInfo: {
provider: 'tiktok',
mediaType: 'video',
},
})).toBe(undefined);
});
test('TikTok: video urls', () => {
testUrls(newParser(), {
videoInfo: {
provider: 'tiktok',
id: '6850560663916449029',
channel: 'psg',
mediaType: 'video',
params: {
lang: 'en',
},
},
formats: {
long: 'https://www.tiktok.com/@psg/video/6850560663916449029?lang=en',
},
urls: [
'https://www.tiktok.com/@psg/video/6850560663916449029?lang=en',
],
});
});