X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftests%2Fapi%2Fcheck-params%2Fvideo-comments.ts;h=5cf90bacc25407fde6b9a44de5a529b0182bdbb6;hb=97ecddae104f4013d261f0e9645e8b319ff0f1a6;hp=9190054da9fa70d6fa57139f7ce8bda23f509790;hpb=4cb6d4578893db310297d7e118ce2fb7ecb952a3;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tests/api/check-params/video-comments.ts b/server/tests/api/check-params/video-comments.ts index 9190054da..5cf90bacc 100644 --- a/server/tests/api/check-params/video-comments.ts +++ b/server/tests/api/check-params/video-comments.ts @@ -3,12 +3,23 @@ import * as chai from 'chai' import 'mocha' import { + cleanupTests, createUser, - flushTests, killallServers, makeDeleteRequest, makeGetRequest, makePostBodyRequest, runServer, ServerInfo, setAccessTokensToServers, - uploadVideo, userLogin -} from '../../utils' -import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '../../utils/requests/check-api-params' -import { addVideoCommentThread } from '../../utils/videos/video-comments' + flushAndRunServer, + makeDeleteRequest, + makeGetRequest, + makePostBodyRequest, + ServerInfo, + setAccessTokensToServers, + uploadVideo, + userLogin +} from '../../../../shared/extra-utils' +import { + checkBadCountPagination, + checkBadSortPagination, + checkBadStartPagination +} from '../../../../shared/extra-utils/requests/check-api-params' +import { addVideoCommentThread } from '../../../../shared/extra-utils/videos/video-comments' const expect = chai.expect @@ -23,11 +34,9 @@ describe('Test video comments API validator', function () { // --------------------------------------------------------------- before(async function () { - this.timeout(20000) - - await flushTests() + this.timeout(30000) - server = await runServer(1) + server = await flushAndRunServer(1) await setAccessTokensToServers([ server ]) @@ -48,7 +57,7 @@ describe('Test video comments API validator', function () { username: 'user1', password: 'my super password' } - await createUser(server.url, server.accessToken, user.username, user.password) + await createUser({ url: server.url, accessToken: server.accessToken, username: user.username, password: user.password }) userAccessToken = await userLogin(server, user) } }) @@ -117,7 +126,7 @@ describe('Test video comments API validator', function () { it('Should fail with a short comment', async function () { const fields = { - text: 'h'.repeat(3001) + text: '' } await makePostBodyRequest({ url: server.url, path: pathThread, token: server.accessToken, fields }) }) @@ -160,7 +169,7 @@ describe('Test video comments API validator', function () { it('Should fail with a short comment', async function () { const fields = { - text: 'h'.repeat(3001) + text: '' } await makePostBodyRequest({ url: server.url, path: pathComment, token: server.accessToken, fields }) }) @@ -250,11 +259,6 @@ describe('Test video comments API validator', function () { }) after(async function () { - killallServers([ server ]) - - // Keep the logs if the test failed - if (this['ok']) { - await flushTests() - } + await cleanupTests([ server ]) }) })