Download manager is now functional

Added UI support for new downloads schema

Implemented draft test for downloads

Cleaned up unused code snippets
This commit is contained in:
Isaac Abadi
2021-08-08 21:29:31 -06:00
parent 5a90be7703
commit 0360469c5a
10 changed files with 288 additions and 182 deletions

View File

@@ -40,7 +40,7 @@ const subscriptions_api = require('../subscriptions');
const fs = require('fs-extra');
const { uuid } = require('uuidv4');
db_api.initialize(db, users_db, logger);
db_api.initialize(db, users_db);
describe('Database', async function() {
@@ -286,40 +286,43 @@ describe('Multi User', async function() {
// assert(video_obj);
// });
// });
});
describe('Downloader', function() {
const url = '';
const options = {
ui_uid: uuid(),
user: 'admin'
}
describe('Downloader', function() {
const downloader_api = require('../downloader');
downloader_api.initialize(db_api);
const url = 'https://www.youtube.com/watch?v=dQw4w9WgXcQ';
const options = {
ui_uid: uuid(),
user: 'admin'
}
const download = {
url: url,
options: options,
type: 'video'
}
beforeEach(async function() {
await db_api.connectToDB();
await db_api.removeAllRecords('download_queue');
await db_api.insertRecordIntoTable('download_queue', download)
});
it('Get file info', async function() {
});
it('Download file', async function() {
});
it('Queue file', async function() {
});
it('Pause file', async function() {
});
beforeEach(async function() {
await db_api.connectToDB();
await db_api.removeAllRecords('download_queue');
});
});
it('Get file info', async function() {
});
it('Download file', async function() {
this.timeout(300000);
const returned_download = await downloader_api.createDownload(url, 'video', options);
console.log(returned_download);
await utils.wait(20000);
});
it('Queue file', async function() {
this.timeout(300000);
const returned_download = await downloader_api.createDownload(url, 'video', options);
console.log(returned_download);
await utils.wait(20000);
});
it('Pause file', async function() {
});
});