-import 'mocha'
-import * as chai from 'chai'
+import { expect } from 'chai'
+import { AbuseMessage, AbusePredefinedReasonsString, AbuseState, AdminAbuse, UserAbuse } from '@shared/models'
describe('Test abuses', function () {
let servers: PeerTubeServer[] = []
describe('Test abuses', function () {
let servers: PeerTubeServer[] = []
// Server 1 and server 2 follow each other
await doubleFollow(servers[0], servers[1])
// Server 1 and server 2 follow each other
await doubleFollow(servers[0], servers[1])
expect(abuse2.reporterAccount.name).to.equal('root')
expect(abuse2.reporterAccount.host).to.equal(servers[0].host)
expect(abuse2.reporterAccount.name).to.equal('root')
expect(abuse2.reporterAccount.host).to.equal(servers[0].host)
- expect(body.total).to.equal(2, "wrong number of videos returned")
- expect(body.data).to.have.lengthOf(2, "wrong number of videos returned")
+ expect(body.total).to.equal(2, 'wrong number of videos returned')
+ expect(body.data).to.have.lengthOf(2, 'wrong number of videos returned')
- expect(abuse.id).to.equal(abuseServer2.id, "wrong origin server id for first video")
- expect(abuse.video.id).to.equal(abuseServer2.video.id, "wrong video id")
+ expect(abuse.id).to.equal(abuseServer2.id, 'wrong origin server id for first video')
+ expect(abuse.video.id).to.equal(abuseServer2.video.id, 'wrong video id')
const abuseVideo3 = body.data.find(a => a.video.id === video3Id)
expect(abuseVideo3).to.not.be.undefined
const abuseVideo3 = body.data.find(a => a.video.id === video3Id)
expect(abuseVideo3).to.not.be.undefined
- expect(abuseVideo3.video.countReports).to.equal(1, "wrong reports count for video 3")
- expect(abuseVideo3.video.nthReport).to.equal(1, "wrong report position in report list for video 3")
- expect(abuseVideo3.countReportsForReportee).to.equal(1, "wrong reports count for reporter on video 3 abuse")
- expect(abuseVideo3.countReportsForReporter).to.equal(3, "wrong reports count for reportee on video 3 abuse")
+ expect(abuseVideo3.video.countReports).to.equal(1, 'wrong reports count for video 3')
+ expect(abuseVideo3.video.nthReport).to.equal(1, 'wrong report position in report list for video 3')
+ expect(abuseVideo3.countReportsForReportee).to.equal(1, 'wrong reports count for reporter on video 3 abuse')
+ expect(abuseVideo3.countReportsForReporter).to.equal(3, 'wrong reports count for reportee on video 3 abuse')
{
const abuse = body.data.find(a => a.id === createRes.abuse.id)
expect(abuse.reason).to.equals(reason5)
{
const abuse = body.data.find(a => a.id === createRes.abuse.id)
expect(abuse.reason).to.equals(reason5)
expect(abuse.video.startAt).to.equal(1, "starting timestamp doesn't match the one reported")
expect(abuse.video.endAt).to.equal(5, "ending timestamp doesn't match the one reported")
}
expect(abuse.video.startAt).to.equal(1, "starting timestamp doesn't match the one reported")
expect(abuse.video.endAt).to.equal(5, "ending timestamp doesn't match the one reported")
}