1 /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
3 import * as chai from 'chai'
8 flushAndRunMultipleServers,
9 makeActivityPubGetRequest,
11 setAccessTokensToServers,
13 } from '../../../../shared/extra-utils'
15 const expect = chai.expect
17 describe('Test activitypub', function () {
18 let servers: ServerInfo[] = []
21 before(async function () {
24 servers = await flushAndRunMultipleServers(2)
26 await setAccessTokensToServers(servers)
29 const res = await uploadVideo(servers[0].url, servers[0].accessToken, { name: 'video' })
30 videoUUID = res.body.video.uuid
33 await doubleFollow(servers[0], servers[1])
36 it('Should return the account object', async function () {
37 const res = await makeActivityPubGetRequest(servers[0].url, '/accounts/root')
38 const object = res.body
40 expect(object.type).to.equal('Person')
41 expect(object.id).to.equal('http://localhost:' + servers[0].port + '/accounts/root')
42 expect(object.name).to.equal('root')
43 expect(object.preferredUsername).to.equal('root')
46 it('Should return the video object', async function () {
47 const res = await makeActivityPubGetRequest(servers[0].url, '/videos/watch/' + videoUUID)
48 const object = res.body
50 expect(object.type).to.equal('Video')
51 expect(object.id).to.equal('http://localhost:' + servers[0].port + '/videos/watch/' + videoUUID)
52 expect(object.name).to.equal('video')
55 it('Should redirect to the origin video object', async function () {
56 const res = await makeActivityPubGetRequest(servers[1].url, '/videos/watch/' + videoUUID, 302)
58 expect(res.header.location).to.equal('http://localhost:' + servers[0].port + '/videos/watch/' + videoUUID)
61 after(async function () {
62 await cleanupTests(servers)