Skip to content
This repository was archived by the owner on Oct 19, 2019. It is now read-only.

Commit 1803340

Browse files
committed
added tests
1 parent ba0cc2d commit 1803340

File tree

4 files changed

+44
-3
lines changed

4 files changed

+44
-3
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
node_modules
2-
test.js
32
.idea
43
.git

.npmignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
node_modules
2-
test.js
32
.idea
43
.git

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
},
2323
"devDependencies": {},
2424
"scripts": {
25-
"test": "exit 0"
25+
"test": "node test.js"
2626
},
2727
"keywords": [
2828
"source",

test.js

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
const { config, scrappers, classes: { StreamInfo, HosterInfo }} = require('./index.js');
2+
3+
(async () => {
4+
//config.puppeteer.headless = false;
5+
//config.puppeteer.executablePath = 'C:\\Users\\Admin\\AppData\\Local\\Google\\Chrome SxS\\Application\\chrome.exe';
6+
7+
const urls = [
8+
'https://openload.co/embed/zRpmqpRRaac/YuGiOhArcVEpisode123-rh-480.x.mp4',
9+
'https://oload.tv/embed/fZOeAHeGgcI',
10+
'http://streamcloud.eu/dx008gqtcsdw/jumanji.SD-spectre.mkv.html',
11+
'https://vidzi.tv/8yrmh5ooflp6.html',
12+
'http://vidstreaming.io/streaming.php?id=NzUwMDI=&title=Mob+Psycho+100+Episode+9',
13+
'https://streamango.com/embed/klkflffksmotebqk/YuGiOhArcVEpisode123-rh-343_mp4',
14+
'https://rapidvideo.com/e/FO24ULAW2H',
15+
16+
'https://ww3.gogoanime.io/death-note-episode-19',
17+
'http://kissanime.ru/Anime/Yu-Gi-Oh-Arc-V-Dub/Episode-123?id=142754&s=default'
18+
];
19+
20+
let allSuccess = true;
21+
try {
22+
for (let url of urls) {
23+
const scrapper = scrappers.all.getFirstApplicable(url);
24+
const scrap = await scrapper.run(url);
25+
26+
const success =
27+
scrap.info &&
28+
scrap.info instanceof StreamInfo && scrap.info.source.length > 0 ||
29+
scrap.info instanceof HosterInfo && scrap.info.hoster.length > 0;
30+
31+
console.log(`${scrapper.name}: ${success}`);
32+
33+
if (!success)
34+
allSuccess = false;
35+
}
36+
} catch (err) {
37+
allSuccess = false;
38+
console.log(err);
39+
throw 'Unexpected error during testing';
40+
}
41+
if (!allSuccess)
42+
throw ''
43+
})();

0 commit comments

Comments
 (0)