|
|
|
@ -388,10 +388,18 @@ describe('Downloader', function() {
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('Inject args', async function() {
|
|
|
|
|
const original_args = ['--no-resize-buffer', '-o', '%(title)s', '--no-mtime'];
|
|
|
|
|
const new_args = ['--age-limit', '25', '--yes-playlist', '--abort-on-error', '-o', '%(id)s'];
|
|
|
|
|
const updated_args = utils.injectArgs(original_args, new_args);
|
|
|
|
|
assert(updated_args, ['--no-resize-buffer', '--no-mtime', '--age-limit', '25', '--yes-playlist', '--abort-on-error', '-o', '%(id)s']);
|
|
|
|
|
const original_args1 = ['--no-resize-buffer', '-o', '%(title)s', '--no-mtime'];
|
|
|
|
|
const new_args1 = ['--age-limit', '25', '--yes-playlist', '--abort-on-error', '-o', '%(id)s'];
|
|
|
|
|
const updated_args1 = utils.injectArgs(original_args1, new_args1);
|
|
|
|
|
const expected_args1 = ['--no-resize-buffer', '--no-mtime', '--age-limit', '25', '--yes-playlist', '--abort-on-error', '-o', '%(id)s'];
|
|
|
|
|
assert(JSON.stringify(updated_args1), JSON.stringify(expected_args1));
|
|
|
|
|
|
|
|
|
|
const original_args2 = ['-o', '%(title)s.%(ext)s', '--write-info-json', '--print-json', '--audio-quality', '0', '-x', '--audio-format', 'mp3'];
|
|
|
|
|
const new_args2 = ['--add-metadata', '--embed-thumbnail', '--convert-thumbnails', 'jpg'];
|
|
|
|
|
const updated_args2 = utils.injectArgs(original_args2, new_args2);
|
|
|
|
|
const expected_args2 = ['-o', '%(title)s.%(ext)s', '--write-info-json', '--print-json', '--audio-quality', '0', '-x', '--audio-format', 'mp3', '--add-metadata', '--embed-thumbnail', '--convert_thumbnails', 'jpg'];
|
|
|
|
|
console.log(updated_args2);
|
|
|
|
|
assert(JSON.stringify(updated_args2), JSON.stringify(expected_args2));
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|