/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
-import 'mocha'
-import * as chai from 'chai'
+import { expect } from 'chai'
import { dateIsValid, testImage } from '@server/tests/shared'
-import { cleanupTests, CommentsCommand, createSingleServer, PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands'
-
-const expect = chai.expect
+import {
+ cleanupTests,
+ CommentsCommand,
+ createSingleServer,
+ PeerTubeServer,
+ setAccessTokensToServers,
+ setDefaultAccountAvatar,
+ setDefaultChannelAvatar
+} from '@shared/server-commands'
describe('Test video comments', function () {
let server: PeerTubeServer
videoUUID = uuid
videoId = id
- await server.users.updateMyAvatar({ fixture: 'avatar.png' })
+ await setDefaultChannelAvatar(server)
+ await setDefaultAccountAvatar(server)
userAccessTokenServer1 = await server.users.generateUserAndToken('user1')
expect(comment.account.name).to.equal('root')
expect(comment.account.host).to.equal('localhost:' + server.port)
- await testImage(server.url, 'avatar-resized', comment.account.avatar.path, '.png')
+ for (const avatar of comment.account.avatars) {
+ await testImage(server.url, `avatar-resized-${avatar.width}x${avatar.width}`, avatar.path, '.png')
+ }
expect(comment.totalReplies).to.equal(0)
expect(comment.totalRepliesFromVideoAuthor).to.equal(0)
expect(total).to.equal(0)
})
+ it('Should filter instance comments by onLocalVideo', async function () {
+ {
+ const { total, data } = await command.listForAdmin({ onLocalVideo: false })
+
+ expect(data).to.have.lengthOf(0)
+ expect(total).to.equal(0)
+ }
+
+ {
+ const { total, data } = await command.listForAdmin({ onLocalVideo: true })
+
+ expect(data).to.not.have.lengthOf(0)
+ expect(total).to.not.equal(0)
+ }
+ })
+
it('Should search instance comments by account', async function () {
const { total, data } = await command.listForAdmin({ searchAccount: 'user' })