aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/activitypub/client.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api/activitypub/client.ts')
-rw-r--r--server/tests/api/activitypub/client.ts20
1 files changed, 19 insertions, 1 deletions
diff --git a/server/tests/api/activitypub/client.ts b/server/tests/api/activitypub/client.ts
index e69ab3cb9..655fa30d0 100644
--- a/server/tests/api/activitypub/client.ts
+++ b/server/tests/api/activitypub/client.ts
@@ -2,6 +2,8 @@
2 2
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { processViewersStats } from '@server/tests/shared'
6import { HttpStatusCode, VideoPlaylistPrivacy, WatchActionObject } from '@shared/models'
5import { 7import {
6 cleanupTests, 8 cleanupTests,
7 createMultipleServers, 9 createMultipleServers,
@@ -11,7 +13,6 @@ import {
11 setAccessTokensToServers, 13 setAccessTokensToServers,
12 setDefaultVideoChannel 14 setDefaultVideoChannel
13} from '@shared/server-commands' 15} from '@shared/server-commands'
14import { HttpStatusCode, VideoPlaylistPrivacy } from '@shared/models'
15 16
16const expect = chai.expect 17const expect = chai.expect
17 18
@@ -115,6 +116,23 @@ describe('Test activitypub', function () {
115 expect(res.header.location).to.equal('http://localhost:' + servers[0].port + '/videos/watch/' + video.uuid) 116 expect(res.header.location).to.equal('http://localhost:' + servers[0].port + '/videos/watch/' + video.uuid)
116 }) 117 })
117 118
119 it('Should return the watch action', async function () {
120 this.timeout(50000)
121
122 await servers[0].views.simulateViewer({ id: video.uuid, currentTimes: [ 0, 2 ] })
123 await processViewersStats(servers)
124
125 const res = await makeActivityPubGetRequest(servers[0].url, '/videos/local-viewer/1', HttpStatusCode.OK_200)
126
127 const object: WatchActionObject = res.body
128 expect(object.type).to.equal('WatchAction')
129 expect(object.duration).to.equal('PT2S')
130 expect(object.actionStatus).to.equal('CompletedActionStatus')
131 expect(object.watchSections).to.have.lengthOf(1)
132 expect(object.watchSections[0].startTimestamp).to.equal(0)
133 expect(object.watchSections[0].endTimestamp).to.equal(2)
134 })
135
118 after(async function () { 136 after(async function () {
119 await cleanupTests(servers) 137 await cleanupTests(servers)
120 }) 138 })