diff options
Diffstat (limited to 'server/tests')
-rw-r--r-- | server/tests/api/video-comments.ts | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/server/tests/api/video-comments.ts b/server/tests/api/video-comments.ts index 2f1e6260a..2c7d1c6e2 100644 --- a/server/tests/api/video-comments.ts +++ b/server/tests/api/video-comments.ts | |||
@@ -39,7 +39,18 @@ describe('Test video comments', function () { | |||
39 | it('Should create a thread in this video', async function () { | 39 | it('Should create a thread in this video', async function () { |
40 | const text = 'my super first comment' | 40 | const text = 'my super first comment' |
41 | 41 | ||
42 | await addVideoCommentThread(server.url, server.accessToken, videoUUID, text) | 42 | const res = await addVideoCommentThread(server.url, server.accessToken, videoUUID, text) |
43 | const comment = res.body | ||
44 | |||
45 | expect(comment.inReplyToCommentId).to.be.null | ||
46 | expect(comment.text).equal('my super first comment') | ||
47 | expect(comment.videoId).to.equal(videoId) | ||
48 | expect(comment.id).to.equal(comment.threadId) | ||
49 | expect(comment.account.name).to.equal('root') | ||
50 | expect(comment.account.host).to.equal('localhost:9001') | ||
51 | expect(comment.totalReplies).to.equal(0) | ||
52 | expect(dateIsValid(comment.createdAt as string)).to.be.true | ||
53 | expect(dateIsValid(comment.updatedAt as string)).to.be.true | ||
43 | }) | 54 | }) |
44 | 55 | ||
45 | it('Should list threads of this video', async function () { | 56 | it('Should list threads of this video', async function () { |
@@ -55,6 +66,8 @@ describe('Test video comments', function () { | |||
55 | expect(comment.videoId).to.equal(videoId) | 66 | expect(comment.videoId).to.equal(videoId) |
56 | expect(comment.id).to.equal(comment.threadId) | 67 | expect(comment.id).to.equal(comment.threadId) |
57 | expect(comment.account.name).to.equal('root') | 68 | expect(comment.account.name).to.equal('root') |
69 | expect(comment.account.host).to.equal('localhost:9001') | ||
70 | expect(comment.totalReplies).to.equal(0) | ||
58 | expect(dateIsValid(comment.createdAt as string)).to.be.true | 71 | expect(dateIsValid(comment.createdAt as string)).to.be.true |
59 | expect(dateIsValid(comment.updatedAt as string)).to.be.true | 72 | expect(dateIsValid(comment.updatedAt as string)).to.be.true |
60 | 73 | ||
@@ -120,8 +133,11 @@ describe('Test video comments', function () { | |||
120 | expect(res.body.data).to.have.lengthOf(3) | 133 | expect(res.body.data).to.have.lengthOf(3) |
121 | 134 | ||
122 | expect(res.body.data[0].text).to.equal('my super first comment') | 135 | expect(res.body.data[0].text).to.equal('my super first comment') |
136 | expect(res.body.data[0].totalReplies).to.equal(2) | ||
123 | expect(res.body.data[1].text).to.equal('super thread 2') | 137 | expect(res.body.data[1].text).to.equal('super thread 2') |
138 | expect(res.body.data[1].totalReplies).to.equal(1) | ||
124 | expect(res.body.data[2].text).to.equal('super thread 3') | 139 | expect(res.body.data[2].text).to.equal('super thread 3') |
140 | expect(res.body.data[2].totalReplies).to.equal(0) | ||
125 | }) | 141 | }) |
126 | 142 | ||
127 | after(async function () { | 143 | after(async function () { |