diff options
Diffstat (limited to 'server/tests/activitypub.ts')
-rw-r--r-- | server/tests/activitypub.ts | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/server/tests/activitypub.ts b/server/tests/activitypub.ts new file mode 100644 index 000000000..333e02e84 --- /dev/null +++ b/server/tests/activitypub.ts | |||
@@ -0,0 +1,42 @@ | |||
1 | /* tslint:disable:no-unused-expression */ | ||
2 | |||
3 | import * as chai from 'chai' | ||
4 | import 'mocha' | ||
5 | import { flushTests, killallServers, ServerInfo, setAccessTokensToServers } from './utils' | ||
6 | import { runServer } from './utils/servers' | ||
7 | import { makeActivityPubGetRequest } from './utils/activitypub' | ||
8 | |||
9 | const expect = chai.expect | ||
10 | |||
11 | describe('Test activitypub', function () { | ||
12 | let server: ServerInfo = null | ||
13 | |||
14 | before(async function () { | ||
15 | this.timeout(10000) | ||
16 | |||
17 | await flushTests() | ||
18 | |||
19 | server = await runServer(1) | ||
20 | |||
21 | await setAccessTokensToServers([ server ]) | ||
22 | }) | ||
23 | |||
24 | it('Should return the account object', async function () { | ||
25 | const res = await makeActivityPubGetRequest(server.url, '/account/root') | ||
26 | const object = res.body | ||
27 | |||
28 | expect(object.type).to.equal('Person') | ||
29 | expect(object.id).to.equal('http://localhost:9001/account/root') | ||
30 | expect(object.name).to.equal('root') | ||
31 | expect(object.preferredUsername).to.equal('root') | ||
32 | }) | ||
33 | |||
34 | after(async function () { | ||
35 | killallServers([ server ]) | ||
36 | |||
37 | // Keep the logs if the test failed | ||
38 | if (this['ok']) { | ||
39 | await flushTests() | ||
40 | } | ||
41 | }) | ||
42 | }) | ||