1 /* tslint:disable:no-unused-expression */
3 import * as chai from 'chai'
7 flushAndRunMultipleServers,
10 makeActivityPubGetRequest,
12 setAccessTokensToServers,
14 } from '../../../../shared/utils'
16 const expect = chai.expect
18 describe('Test activitypub', function () {
19 let servers: ServerInfo[] = []
22 before(async function () {
27 servers = await flushAndRunMultipleServers(2)
29 await setAccessTokensToServers(servers)
32 const res = await uploadVideo(servers[0].url, servers[0].accessToken, { name: 'video' })
33 videoUUID = res.body.video.uuid
36 await doubleFollow(servers[0], servers[1])
39 it('Should return the account object', async function () {
40 const res = await makeActivityPubGetRequest(servers[0].url, '/accounts/root')
41 const object = res.body
43 expect(object.type).to.equal('Person')
44 expect(object.id).to.equal('http://localhost:9001/accounts/root')
45 expect(object.name).to.equal('root')
46 expect(object.preferredUsername).to.equal('root')
49 it('Should return the video object', async function () {
50 const res = await makeActivityPubGetRequest(servers[0].url, '/videos/watch/' + videoUUID)
51 const object = res.body
53 expect(object.type).to.equal('Video')
54 expect(object.id).to.equal('http://localhost:9001/videos/watch/' + videoUUID)
55 expect(object.name).to.equal('video')
58 it('Should redirect to the origin video object', async function () {
59 const res = await makeActivityPubGetRequest(servers[1].url, '/videos/watch/' + videoUUID, 302)
61 expect(res.header.location).to.equal('http://localhost:9001/videos/watch/' + videoUUID)
64 after(async function () {
65 killallServers(servers)