X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftests%2Fapi%2Fvideos%2Fvideo-comments.ts;h=82182cc7cb90da36c82f1bc4d29f6fd20ed4a093;hb=bec4ea343987c69252b84d02f444c0f033d4a3f9;hp=0eddac35b6a40b4b21ac09abcc2c66c9f7599439;hpb=f05a1c30c15d2ae35c11e241ca039a72eeb7d6ad;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tests/api/videos/video-comments.ts b/server/tests/api/videos/video-comments.ts index 0eddac35b..82182cc7c 100644 --- a/server/tests/api/videos/video-comments.ts +++ b/server/tests/api/videos/video-comments.ts @@ -3,15 +3,22 @@ import * as chai from 'chai' import 'mocha' import { VideoComment, VideoCommentThreadTree } from '../../../../shared/models/videos/video-comment.model' -import { testImage } from '../../utils' +import { cleanupTests, testImage } from '../../../../shared/extra-utils' import { - dateIsValid, flushTests, killallServers, runServer, ServerInfo, setAccessTokensToServers, updateMyAvatar, + dateIsValid, + flushAndRunServer, + ServerInfo, + setAccessTokensToServers, + updateMyAvatar, uploadVideo -} from '../../utils/index' +} from '../../../../shared/extra-utils/index' import { - addVideoCommentReply, addVideoCommentThread, deleteVideoComment, getVideoCommentThreads, + addVideoCommentReply, + addVideoCommentThread, + deleteVideoComment, + getVideoCommentThreads, getVideoThreadComments -} from '../../utils/videos/video-comments' +} from '../../../../shared/extra-utils/videos/video-comments' const expect = chai.expect @@ -23,11 +30,9 @@ describe('Test video comments', function () { let replyToDeleteId: number before(async function () { - this.timeout(10000) + this.timeout(30000) - await flushTests() - - server = await runServer(1) + server = await flushAndRunServer(1) await setAccessTokensToServers([ server ]) @@ -61,8 +66,8 @@ describe('Test video comments', function () { expect(comment.videoId).to.equal(videoId) expect(comment.id).to.equal(comment.threadId) expect(comment.account.name).to.equal('root') - expect(comment.account.host).to.equal('localhost:9001') - expect(comment.account.url).to.equal('http://localhost:9001/accounts/root') + expect(comment.account.host).to.equal('localhost:' + server.port) + expect(comment.account.url).to.equal('http://localhost:' + server.port + '/accounts/root') expect(comment.totalReplies).to.equal(0) expect(dateIsValid(comment.createdAt as string)).to.be.true expect(dateIsValid(comment.updatedAt as string)).to.be.true @@ -81,10 +86,9 @@ describe('Test video comments', function () { expect(comment.videoId).to.equal(videoId) expect(comment.id).to.equal(comment.threadId) expect(comment.account.name).to.equal('root') - expect(comment.account.host).to.equal('localhost:9001') + expect(comment.account.host).to.equal('localhost:' + server.port) - const test = await testImage(server.url, 'avatar-resized', comment.account.avatar.path, '.png') - expect(test).to.equal(true) + await testImage(server.url, 'avatar-resized', comment.account.avatar.path, '.png') expect(comment.totalReplies).to.equal(0) expect(dateIsValid(comment.createdAt as string)).to.be.true @@ -194,11 +198,6 @@ describe('Test video comments', function () { }) after(async function () { - killallServers([ server ]) - - // Keep the logs if the test failed - if (this['ok']) { - await flushTests() - } + await cleanupTests([ server ]) }) })