Skip to content

Commit

Permalink
test(coverage): adjust a test for extra coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
fent committed Jan 6, 2021
1 parent 3609aa2 commit 5fed9e5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/info.js
Expand Up @@ -250,7 +250,7 @@ const parseJSON = (source, varName, json) => {
};


const findJSON = (source, varName, body, left, right, prependJSON = '') => {
const findJSON = (source, varName, body, left, right, prependJSON) => {
let jsonStr = utils.between(body, left, right);
if (!jsonStr) {
throw Error(`Could not find ${varName} in ${source}`);
Expand Down
7 changes: 7 additions & 0 deletions test/basic-info-test.js
Expand Up @@ -218,17 +218,24 @@ describe('ytdl.getBasicInfo()', () => {
describe('`x-youtube-identity-token` not given', () => {
it('Retrieves identity-token from watch.html page', async() => {
const scope = nock(id, 'regular', {
watchHtml: [true, 400],
get_video_info: false,
player: false,
});
const scope2 = nock(id, 'regular', {
watchHtml: [true, 200, body => `${body}\n{"ID_TOKEN":"abcd"}`],
watchJson: false,
get_video_info: false,
player: false,
});
let info = await ytdl.getBasicInfo(id, {
requestOptions: {
maxRetries: 1,
headers: { cookie: 'abc=1' },
},
});
scope.done();
scope2.done();
assert.ok(info.formats.length);
});

Expand Down

0 comments on commit 5fed9e5

Please sign in to comment.