aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/activitypub.ts
blob: 0905c5dec9cd9d5a1939903b79a185e1c9df4082 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/* tslint:disable:no-unused-expression */

import * as chai from 'chai'
import 'mocha'
import {
  flushTests,
  killallServers,
  makeActivityPubGetRequest,
  runServer,
  ServerInfo,
  setAccessTokensToServers
} from '../../shared/utils'

const expect = chai.expect

describe('Test activitypub', function () {
  let server: ServerInfo = null

  before(async function () {
    this.timeout(30000)

    await flushTests()

    server = await runServer(1)

    await setAccessTokensToServers([ server ])
  })

  it('Should return the account object', async function () {
    const res = await makeActivityPubGetRequest(server.url, '/accounts/root')
    const object = res.body

    expect(object.type).to.equal('Person')
    expect(object.id).to.equal('http://localhost:9001/accounts/root')
    expect(object.name).to.equal('root')
    expect(object.preferredUsername).to.equal('root')
  })

  after(async function () {
    killallServers([ server ])
  })
})