PeerTube/server/tests/activitypub.ts

41 lines
1.0 KiB
TypeScript
Raw Normal View History

2017-11-30 12:00:40 +01:00
/* tslint:disable:no-unused-expression */
import * as chai from 'chai'
import 'mocha'
2017-12-28 13:59:22 +01:00
import { flushTests, killallServers, makeActivityPubGetRequest, runServer, ServerInfo, setAccessTokensToServers } from './utils'
2017-11-30 12:00:40 +01:00
const expect = chai.expect
describe('Test activitypub', function () {
let server: ServerInfo = null
before(async function () {
this.timeout(10000)
await flushTests()
server = await runServer(1)
await setAccessTokensToServers([ server ])
})
it('Should return the account object', async function () {
const res = await makeActivityPubGetRequest(server.url, '/account/root')
const object = res.body
expect(object.type).to.equal('Person')
expect(object.id).to.equal('http://localhost:9001/account/root')
expect(object.name).to.equal('root')
expect(object.preferredUsername).to.equal('root')
})
after(async function () {
killallServers([ server ])
// Keep the logs if the test failed
if (this['ok']) {
await flushTests()
}
})
})