Fixed youtube-dl test

This commit is contained in:
Tzahi12345
2023-11-27 00:45:22 -05:00
parent 9ca6563b36
commit 9d674c51ca
2 changed files with 6 additions and 5 deletions

View File

@@ -631,10 +631,11 @@ describe('youtube-dl', async function() {
await youtubedl_api.checkForYoutubeDLUpdate();
});
it('Check latest version', async function() {
const latest_version = await youtubedl_api.checkForYoutubeDLUpdate();
const original_fork = config_api.getConfigItem('ytdl_default_downloader');
const latest_version = await youtubedl_api.getLatestUpdateVersion(original_fork);
const default_details_bin = fs.readJSONSync(CONSTS.DETAILS_BIN_PATH);
assert(default_details_bin['version'] === CONSTS.OUTDATED_YOUTUBEDL_VERSION);
assert(latest_version > default_details_bin['version']);
assert(default_details_bin[original_fork]['version'] === CONSTS.OUTDATED_YOUTUBEDL_VERSION);
assert(latest_version > default_details_bin[original_fork]['version']);
});
it('Update youtube-dl', async function() {

View File

@@ -96,7 +96,7 @@ exports.checkForYoutubeDLUpdate = async () => {
const current_version = current_app_details['version'];
const current_fork = current_app_details['downloader'];
const latest_version = await getLatestUpdateVersion(selected_fork);
const latest_version = await exports.getLatestUpdateVersion(selected_fork);
// if the binary does not exist, or default_downloader doesn't match existing fork, or if the fork has been updated, redownload
// TODO: don't redownload if fork already exists
if (!fs.existsSync(output_file_path) || current_fork !== selected_fork || !current_version || current_version !== latest_version) {
@@ -124,7 +124,7 @@ async function downloadLatestYoutubeDLBinaryGeneric(youtubedl_fork, new_version,
updateDetailsJSON(new_version, youtubedl_fork, output_path);
}
const getLatestUpdateVersion = async (youtubedl_fork) => {
exports.getLatestUpdateVersion = async (youtubedl_fork) => {
const tags_url = exports.youtubedl_forks[youtubedl_fork]['tags_url'];
return new Promise(resolve => {
fetch(tags_url, {method: 'Get'})