diff options
author | Chocobozzz <me@florianbigard.com> | 2017-12-27 16:11:53 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2017-12-27 16:11:53 +0100 |
commit | 4635f59d7c3fea4b97029f10886c62fdf38b2084 (patch) | |
tree | d97357a00042bbfb33c4177ee24c01171d28dfce /server/tests/api | |
parent | ea44f375f5d3da06ca0aebfe871b9f924a26ec29 (diff) | |
download | PeerTube-4635f59d7c3fea4b97029f10886c62fdf38b2084.tar.gz PeerTube-4635f59d7c3fea4b97029f10886c62fdf38b2084.tar.zst PeerTube-4635f59d7c3fea4b97029f10886c62fdf38b2084.zip |
Add video comment components
Diffstat (limited to 'server/tests/api')
-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 () { |