X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftests%2Fapi%2Fusers%2Fusers-verification.ts;h=3b37a26cfe2721a85aba227e1e34f4636da89d6b;hb=e590b4a512617bbf63595b684386f68abea7d8b8;hp=b1733e45e95bc09d413d9001470b6594385e09a2;hpb=ae28cdf327d782e629379eee1999096ca2a5d74b;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tests/api/users/users-verification.ts b/server/tests/api/users/users-verification.ts index b1733e45e..3b37a26cf 100644 --- a/server/tests/api/users/users-verification.ts +++ b/server/tests/api/users/users-verification.ts @@ -4,11 +4,11 @@ import * as chai from 'chai' import 'mocha' import { registerUser, flushTests, getUserInformation, getMyUserInformation, killallServers, - userLogin, login, runServer, ServerInfo, verifyEmail, updateCustomSubConfig -} from '../../../../shared/utils' -import { setAccessTokensToServers } from '../../../../shared/utils/users/login' -import { mockSmtpServer } from '../../../../shared/utils/miscs/email' -import { waitJobs } from '../../../../shared/utils/server/jobs' + userLogin, login, flushAndRunServer, ServerInfo, verifyEmail, updateCustomSubConfig, wait, cleanupTests +} from '../../../../shared/extra-utils' +import { setAccessTokensToServers } from '../../../../shared/extra-utils/users/login' +import { MockSmtpServer } from '../../../../shared/extra-utils/miscs/email' +import { waitJobs } from '../../../../shared/extra-utils/server/jobs' const expect = chai.expect @@ -30,16 +30,15 @@ describe('Test users account verification', function () { before(async function () { this.timeout(30000) - await mockSmtpServer(emails) - - await flushTests() + const port = await MockSmtpServer.Instance.collectEmails(emails) const overrideConfig = { smtp: { - hostname: 'localhost' + hostname: 'localhost', + port } } - server = await runServer(1, overrideConfig) + server = await flushAndRunServer(1, overrideConfig) await setAccessTokensToServers([ server ]) }) @@ -123,11 +122,8 @@ describe('Test users account verification', function () { }) after(async function () { - killallServers([ server ]) + MockSmtpServer.Instance.kill() - // Keep the logs if the test failed - if (this[ 'ok' ]) { - await flushTests() - } + await cleanupTests([ server ]) }) })