]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/api/videos/video-comments.ts
Merge branch 'feature/SO035' into develop
[github/Chocobozzz/PeerTube.git] / server / tests / api / videos / video-comments.ts
index 6d74a865f8ff35020d087ba09e763ddad32699b4..5485b72ec4519c2aaf125d8b6ff0a9a41df78584 100644 (file)
@@ -1,6 +1,6 @@
 /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
 
-import * as chai from 'chai'
+import { expect } from 'chai'
 import { dateIsValid, testImage } from '@server/tests/shared'
 import {
   cleanupTests,
@@ -12,8 +12,6 @@ import {
   setDefaultChannelAvatar
 } from '@shared/server-commands'
 
-const expect = chai.expect
-
 describe('Test video comments', function () {
   let server: PeerTubeServer
   let videoId: number
@@ -65,8 +63,8 @@ describe('Test video comments', function () {
       expect(comment.videoId).to.equal(videoId)
       expect(comment.id).to.equal(comment.threadId)
       expect(comment.account.name).to.equal('root')
-      expect(comment.account.host).to.equal('localhost:' + server.port)
-      expect(comment.account.url).to.equal('http://localhost:' + server.port + '/accounts/root')
+      expect(comment.account.host).to.equal(server.host)
+      expect(comment.account.url).to.equal(server.url + '/accounts/root')
       expect(comment.totalReplies).to.equal(0)
       expect(comment.totalRepliesFromVideoAuthor).to.equal(0)
       expect(dateIsValid(comment.createdAt as string)).to.be.true
@@ -87,7 +85,7 @@ describe('Test video comments', function () {
       expect(comment.videoId).to.equal(videoId)
       expect(comment.id).to.equal(comment.threadId)
       expect(comment.account.name).to.equal('root')
-      expect(comment.account.host).to.equal('localhost:' + server.port)
+      expect(comment.account.host).to.equal(server.host)
 
       for (const avatar of comment.account.avatars) {
         await testImage(server.url, `avatar-resized-${avatar.width}x${avatar.width}`, avatar.path, '.png')
@@ -234,7 +232,8 @@ describe('Test video comments', function () {
       await command.addReply({ videoId, toCommentId: threadId2, text: text3 })
 
       const tree = await command.getThread({ videoId: videoUUID, threadId: threadId2 })
-      expect(tree.comment.totalReplies).to.equal(tree.comment.totalRepliesFromVideoAuthor + 1)
+      expect(tree.comment.totalRepliesFromVideoAuthor).to.equal(1)
+      expect(tree.comment.totalReplies).to.equal(2)
     })
   })