aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests')
-rw-r--r--server/tests/api/videos/video-abuse.ts31
-rw-r--r--server/tests/utils/videos/videos.ts3
2 files changed, 18 insertions, 16 deletions
diff --git a/server/tests/api/videos/video-abuse.ts b/server/tests/api/videos/video-abuse.ts
index 3fcf5d8c7..f1c4ef0ce 100644
--- a/server/tests/api/videos/video-abuse.ts
+++ b/server/tests/api/videos/video-abuse.ts
@@ -2,6 +2,7 @@
2 2
3import * as chai from 'chai' 3import * as chai from 'chai'
4import 'mocha' 4import 'mocha'
5import { VideoAbuse } from '../../../../shared/models/videos'
5import { 6import {
6 flushAndRunMultipleServers, 7 flushAndRunMultipleServers,
7 flushTests, 8 flushTests,
@@ -83,11 +84,11 @@ describe('Test video abuses', function () {
83 expect(res1.body.data).to.be.an('array') 84 expect(res1.body.data).to.be.an('array')
84 expect(res1.body.data.length).to.equal(1) 85 expect(res1.body.data.length).to.equal(1)
85 86
86 const abuse = res1.body.data[0] 87 const abuse: VideoAbuse = res1.body.data[0]
87 expect(abuse.reason).to.equal('my super bad reason') 88 expect(abuse.reason).to.equal('my super bad reason')
88 expect(abuse.reporterUsername).to.equal('root') 89 expect(abuse.reporterAccount.name).to.equal('root')
89 expect(abuse.reporterServerHost).to.equal('localhost:9001') 90 expect(abuse.reporterAccount.host).to.equal('localhost:9001')
90 expect(abuse.videoId).to.equal(servers[0].video.id) 91 expect(abuse.video.id).to.equal(servers[0].video.id)
91 92
92 const res2 = await getVideoAbusesList(servers[1].url, servers[1].accessToken) 93 const res2 = await getVideoAbusesList(servers[1].url, servers[1].accessToken)
93 expect(res2.body.total).to.equal(0) 94 expect(res2.body.total).to.equal(0)
@@ -111,27 +112,27 @@ describe('Test video abuses', function () {
111 expect(res1.body.data).to.be.an('array') 112 expect(res1.body.data).to.be.an('array')
112 expect(res1.body.data.length).to.equal(2) 113 expect(res1.body.data.length).to.equal(2)
113 114
114 const abuse1 = res1.body.data[0] 115 const abuse1: VideoAbuse = res1.body.data[0]
115 expect(abuse1.reason).to.equal('my super bad reason') 116 expect(abuse1.reason).to.equal('my super bad reason')
116 expect(abuse1.reporterUsername).to.equal('root') 117 expect(abuse1.reporterAccount.name).to.equal('root')
117 expect(abuse1.reporterServerHost).to.equal('localhost:9001') 118 expect(abuse1.reporterAccount.host).to.equal('localhost:9001')
118 expect(abuse1.videoId).to.equal(servers[0].video.id) 119 expect(abuse1.video.id).to.equal(servers[0].video.id)
119 120
120 const abuse2 = res1.body.data[1] 121 const abuse2: VideoAbuse = res1.body.data[1]
121 expect(abuse2.reason).to.equal('my super bad reason 2') 122 expect(abuse2.reason).to.equal('my super bad reason 2')
122 expect(abuse2.reporterUsername).to.equal('root') 123 expect(abuse2.reporterAccount.name).to.equal('root')
123 expect(abuse2.reporterServerHost).to.equal('localhost:9001') 124 expect(abuse2.reporterAccount.host).to.equal('localhost:9001')
124 expect(abuse2.videoId).to.equal(servers[1].video.id) 125 expect(abuse2.video.id).to.equal(servers[1].video.id)
125 126
126 const res2 = await getVideoAbusesList(servers[1].url, servers[1].accessToken) 127 const res2 = await getVideoAbusesList(servers[1].url, servers[1].accessToken)
127 expect(res2.body.total).to.equal(1) 128 expect(res2.body.total).to.equal(1)
128 expect(res2.body.data).to.be.an('array') 129 expect(res2.body.data).to.be.an('array')
129 expect(res2.body.data.length).to.equal(1) 130 expect(res2.body.data.length).to.equal(1)
130 131
131 const abuse3 = res2.body.data[0] 132 const abuse3: VideoAbuse = res2.body.data[0]
132 expect(abuse3.reason).to.equal('my super bad reason 2') 133 expect(abuse3.reason).to.equal('my super bad reason 2')
133 expect(abuse3.reporterUsername).to.equal('root') 134 expect(abuse3.reporterAccount.name).to.equal('root')
134 expect(abuse3.reporterServerHost).to.equal('localhost:9001') 135 expect(abuse3.reporterAccount.host).to.equal('localhost:9001')
135 }) 136 })
136 137
137 after(async function () { 138 after(async function () {
diff --git a/server/tests/utils/videos/videos.ts b/server/tests/utils/videos/videos.ts
index 4b57f24b5..ec40c5465 100644
--- a/server/tests/utils/videos/videos.ts
+++ b/server/tests/utils/videos/videos.ts
@@ -420,7 +420,8 @@ async function completeVideoCheck (
420 expect(videoDetails.tags).to.deep.equal(attributes.tags) 420 expect(videoDetails.tags).to.deep.equal(attributes.tags)
421 expect(videoDetails.privacy).to.deep.equal(attributes.privacy) 421 expect(videoDetails.privacy).to.deep.equal(attributes.privacy)
422 expect(videoDetails.privacyLabel).to.deep.equal(VIDEO_PRIVACIES[attributes.privacy]) 422 expect(videoDetails.privacyLabel).to.deep.equal(VIDEO_PRIVACIES[attributes.privacy])
423 expect(videoDetails.account.name).to.equal(attributes.account) 423 expect(videoDetails.account.name).to.equal(attributes.account.name)
424 expect(videoDetails.account.host).to.equal(attributes.account.host)
424 expect(videoDetails.commentsEnabled).to.equal(attributes.commentsEnabled) 425 expect(videoDetails.commentsEnabled).to.equal(attributes.commentsEnabled)
425 426
426 expect(videoDetails.channel.displayName).to.equal(attributes.channel.name) 427 expect(videoDetails.channel.displayName).to.equal(attributes.channel.name)