X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftests%2Fapi%2Fvideos%2Fvideos-overview.ts;h=975a5c87a5ab4b2e8256daaeb48831f031cc93e4;hb=bec4ea343987c69252b84d02f444c0f033d4a3f9;hp=1514d1bda07992c9a1fc3fe20619d2777d434609;hpb=2d3741d6d92e9bd1f41694c7442a6d1da434e1f2;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tests/api/videos/videos-overview.ts b/server/tests/api/videos/videos-overview.ts index 1514d1bda..975a5c87a 100644 --- a/server/tests/api/videos/videos-overview.ts +++ b/server/tests/api/videos/videos-overview.ts @@ -2,8 +2,8 @@ import * as chai from 'chai' import 'mocha' -import { flushTests, killallServers, runServer, ServerInfo, setAccessTokensToServers, uploadVideo } from '../../utils' -import { getVideosOverview } from '../../utils/overviews/overviews' +import { cleanupTests, flushAndRunServer, ServerInfo, setAccessTokensToServers, uploadVideo } from '../../../../shared/extra-utils' +import { getVideosOverview } from '../../../../shared/extra-utils/overviews/overviews' import { VideosOverview } from '../../../../shared/models/overviews' const expect = chai.expect @@ -14,9 +14,7 @@ describe('Test a videos overview', function () { before(async function () { this.timeout(30000) - await flushTests() - - server = await runServer(1) + server = await flushAndRunServer(1) await setAccessTokensToServers([ server ]) }) @@ -30,8 +28,10 @@ describe('Test a videos overview', function () { expect(overview.channels).to.have.lengthOf(0) }) - it('Should upload 3 videos in a specific category, tag and channel but not include them in overview', async function () { - for (let i = 0; i < 3; i++) { + it('Should upload 5 videos in a specific category, tag and channel but not include them in overview', async function () { + this.timeout(15000) + + for (let i = 0; i < 5; i++) { await uploadVideo(server.url, server.accessToken, { name: 'video ' + i, category: 3, @@ -49,7 +49,7 @@ describe('Test a videos overview', function () { it('Should upload another video and include all videos in the overview', async function () { await uploadVideo(server.url, server.accessToken, { - name: 'video 3', + name: 'video 5', category: 3, tags: [ 'coucou1', 'coucou2' ] }) @@ -70,11 +70,13 @@ describe('Test a videos overview', function () { for (const attr of [ 'tags', 'categories', 'channels' ]) { const obj = overview[attr][0] - expect(obj.videos).to.have.lengthOf(4) - expect(obj.videos[0].name).to.equal('video 3') - expect(obj.videos[1].name).to.equal('video 2') - expect(obj.videos[2].name).to.equal('video 1') - expect(obj.videos[3].name).to.equal('video 0') + expect(obj.videos).to.have.lengthOf(6) + expect(obj.videos[0].name).to.equal('video 5') + expect(obj.videos[1].name).to.equal('video 4') + expect(obj.videos[2].name).to.equal('video 3') + expect(obj.videos[3].name).to.equal('video 2') + expect(obj.videos[4].name).to.equal('video 1') + expect(obj.videos[5].name).to.equal('video 0') } expect(overview.tags.find(t => t.tag === 'coucou1')).to.not.be.undefined @@ -86,11 +88,6 @@ describe('Test a videos overview', function () { }) after(async function () { - killallServers([ server ]) - - // Keep the logs if the test failed - if (this['ok']) { - await flushTests() - } + await cleanupTests([ server ]) }) })