"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
require("mocha");
const chai_1 = require("chai");
const server_commands_1 = require("../../../../shared/server-commands");
describe('Test videos files', function () {
    let servers;
    let validId1;
    let validId2;
    before(function () {
        return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
            this.timeout(150000);
            servers = yield (0, server_commands_1.createMultipleServers)(2);
            yield (0, server_commands_1.setAccessTokensToServers)(servers);
            yield (0, server_commands_1.doubleFollow)(servers[0], servers[1]);
            yield servers[0].config.enableTranscoding(true, true);
            {
                const { uuid } = yield servers[0].videos.quickUpload({ name: 'video 1' });
                validId1 = uuid;
            }
            {
                const { uuid } = yield servers[0].videos.quickUpload({ name: 'video 2' });
                validId2 = uuid;
            }
            yield (0, server_commands_1.waitJobs)(servers);
        });
    });
    it('Should delete webtorrent files', function () {
        return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
            this.timeout(30000);
            yield servers[0].videos.removeWebTorrentFiles({ videoId: validId1 });
            yield (0, server_commands_1.waitJobs)(servers);
            for (const server of servers) {
                const video = yield server.videos.get({ id: validId1 });
                (0, chai_1.expect)(video.files).to.have.lengthOf(0);
                (0, chai_1.expect)(video.streamingPlaylists).to.have.lengthOf(1);
            }
        });
    });
    it('Should delete HLS files', function () {
        return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
            this.timeout(30000);
            yield servers[0].videos.removeHLSFiles({ videoId: validId2 });
            yield (0, server_commands_1.waitJobs)(servers);
            for (const server of servers) {
                const video = yield server.videos.get({ id: validId2 });
                (0, chai_1.expect)(video.files).to.have.length.above(0);
                (0, chai_1.expect)(video.streamingPlaylists).to.have.lengthOf(0);
            }
        });
    });
    after(function () {
        return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
            yield (0, server_commands_1.cleanupTests)(servers);
        });
    });
});
//# sourceMappingURL=video-files.js.map