Skip to content

Commit

Permalink
test: clean up irl-test.js videos
Browse files Browse the repository at this point in the history
  • Loading branch information
fent committed Nov 4, 2020
1 parent 23a1a0f commit ddb6e3f
Showing 1 changed file with 17 additions and 18 deletions.
35 changes: 17 additions & 18 deletions test/irl-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,39 @@ const nock = require('nock');
const ytdl = require('..');


let videos = {
const videos = {
'Regular video': 'mgOS64BF2eU',
VEVO: 'qQ31INpjXX0',
'VEVO 2': 'pJk0p-98Xzc',
'Age restricted VEVO': 'B3eAMGXFw1o',
'Age restricted': 'BlhyROz85OU',
'Age restricted': 'LuZu9N53Vd0',
'Embed domain restricted': 'B3eAMGXFw1o',
'No embed allowed': 'GFg8BP01F5Q',
Offensive: 'hCKDsjLt_qU',
'Live broadcast': '5qap5aO4i9A',
};


describe('Try downloading videos without mocking', function test() {
describe('Try using ytdl-core without mocking', function test() {
this.retries(1);
beforeEach(() => {
afterEach(() => {
nock.cleanAll();
nock.enableNetConnect();
ytdl.cache.sig.clear();
ytdl.cache.info.clear();
ytdl.cache.cookie.clear();
});

Object.keys(videos).forEach(desc => {
const video = videos[desc];
describe(desc, () => {
it('Request status code is 2xx', done => {
const stream = ytdl(video);
stream.on('error', done);
stream.once('response', res => {
stream.destroy();
assert.ok(res.statusCode >= 200 && res.statusCode < 300);
done();
describe('Try starting a download', () => {
for (let [desc, videoID] of Object.entries(videos)) {
describe(desc, () => {
it('Request status code is 2xx', done => {
const stream = ytdl(videoID);
stream.on('error', done);
stream.once('response', res => {
stream.destroy();
assert.ok(res.statusCode >= 200 && res.statusCode < 300);
done();
});
});
});
});
}
});
});

0 comments on commit ddb6e3f

Please sign in to comment.