]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/api/activitypub/client.ts
Merge branch 'release/3.2.0' into develop
[github/Chocobozzz/PeerTube.git] / server / tests / api / activitypub / client.ts
index 52e7e27f8bb6cce5f9cce61b9f999af22402fa5f..b6c538e19781a2f1cd445f1cf8cb40056f1ed1cd 100644 (file)
@@ -1,17 +1,17 @@
-/* tslint:disable:no-unused-expression */
+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
 
 import * as chai from 'chai'
 import 'mocha'
 import {
+  cleanupTests,
   doubleFollow,
   flushAndRunMultipleServers,
-  flushTests,
-  killallServers,
   makeActivityPubGetRequest,
   ServerInfo,
   setAccessTokensToServers,
   uploadVideo
 } from '../../../../shared/extra-utils'
+import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
 
 const expect = chai.expect
 
@@ -22,8 +22,6 @@ describe('Test activitypub', function () {
   before(async function () {
     this.timeout(30000)
 
-    await flushTests()
-
     servers = await flushAndRunMultipleServers(2)
 
     await setAccessTokensToServers(servers)
@@ -41,7 +39,7 @@ describe('Test activitypub', function () {
     const object = res.body
 
     expect(object.type).to.equal('Person')
-    expect(object.id).to.equal('http://localhost:9001/accounts/root')
+    expect(object.id).to.equal('http://localhost:' + servers[0].port + '/accounts/root')
     expect(object.name).to.equal('root')
     expect(object.preferredUsername).to.equal('root')
   })
@@ -51,17 +49,17 @@ describe('Test activitypub', function () {
     const object = res.body
 
     expect(object.type).to.equal('Video')
-    expect(object.id).to.equal('http://localhost:9001/videos/watch/' + videoUUID)
+    expect(object.id).to.equal('http://localhost:' + servers[0].port + '/videos/watch/' + videoUUID)
     expect(object.name).to.equal('video')
   })
 
   it('Should redirect to the origin video object', async function () {
-    const res = await makeActivityPubGetRequest(servers[1].url, '/videos/watch/' + videoUUID, 302)
+    const res = await makeActivityPubGetRequest(servers[1].url, '/videos/watch/' + videoUUID, HttpStatusCode.FOUND_302)
 
-    expect(res.header.location).to.equal('http://localhost:9001/videos/watch/' + videoUUID)
+    expect(res.header.location).to.equal('http://localhost:' + servers[0].port + '/videos/watch/' + videoUUID)
   })
 
   after(async function () {
-    killallServers(servers)
+    await cleanupTests(servers)
   })
 })