aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-04-04 10:21:36 +0200
committerChocobozzz <me@florianbigard.com>2018-04-04 10:21:36 +0200
commitc49db162ee3ad0acf89f4e71ac0083b30ab798ea (patch)
tree9ab877ac92cc4c341792b932b29f6c05ade668bc /server
parent20760d9160e09bb4efaddffb331395f8d6c3c59d (diff)
downloadPeerTube-c49db162ee3ad0acf89f4e71ac0083b30ab798ea.tar.gz
PeerTube-c49db162ee3ad0acf89f4e71ac0083b30ab798ea.tar.zst
PeerTube-c49db162ee3ad0acf89f4e71ac0083b30ab798ea.zip
Add tests for publishedAt
Diffstat (limited to 'server')
-rw-r--r--server/tests/api/videos/video-privacy.ts9
-rw-r--r--server/tests/utils/videos/videos.ts1
2 files changed, 7 insertions, 3 deletions
diff --git a/server/tests/api/videos/video-privacy.ts b/server/tests/api/videos/video-privacy.ts
index 469274921..8ab37189a 100644
--- a/server/tests/api/videos/video-privacy.ts
+++ b/server/tests/api/videos/video-privacy.ts
@@ -22,9 +22,10 @@ const expect = chai.expect
22 22
23describe('Test video privacy', function () { 23describe('Test video privacy', function () {
24 let servers: ServerInfo[] = [] 24 let servers: ServerInfo[] = []
25 let privateVideoId 25 let privateVideoId: number
26 let privateVideoUUID 26 let privateVideoUUID: string
27 let unlistedVideoUUID 27 let unlistedVideoUUID: string
28 let now: number
28 29
29 before(async function () { 30 before(async function () {
30 this.timeout(50000) 31 this.timeout(50000)
@@ -133,6 +134,7 @@ describe('Test video privacy', function () {
133 privacy: VideoPrivacy.PUBLIC 134 privacy: VideoPrivacy.PUBLIC
134 } 135 }
135 136
137 now = Date.now()
136 await updateVideo(servers[0].url, servers[0].accessToken, privateVideoId, attribute) 138 await updateVideo(servers[0].url, servers[0].accessToken, privateVideoId, attribute)
137 139
138 await wait(5000) 140 await wait(5000)
@@ -145,6 +147,7 @@ describe('Test video privacy', function () {
145 expect(res.body.total).to.equal(1) 147 expect(res.body.total).to.equal(1)
146 expect(res.body.data).to.have.lengthOf(1) 148 expect(res.body.data).to.have.lengthOf(1)
147 expect(res.body.data[0].name).to.equal('super video public') 149 expect(res.body.data[0].name).to.equal('super video public')
150 expect(new Date(res.body.data[0].publishedAt).getTime()).to.be.at.least(now)
148 } 151 }
149 }) 152 })
150 153
diff --git a/server/tests/utils/videos/videos.ts b/server/tests/utils/videos/videos.ts
index 9bda53371..01e7fa5a1 100644
--- a/server/tests/utils/videos/videos.ts
+++ b/server/tests/utils/videos/videos.ts
@@ -427,6 +427,7 @@ async function completeVideoCheck (
427 expect(video.isLocal).to.equal(attributes.isLocal) 427 expect(video.isLocal).to.equal(attributes.isLocal)
428 expect(video.duration).to.equal(attributes.duration) 428 expect(video.duration).to.equal(attributes.duration)
429 expect(dateIsValid(video.createdAt)).to.be.true 429 expect(dateIsValid(video.createdAt)).to.be.true
430 expect(dateIsValid(video.publishedAt)).to.be.true
430 expect(dateIsValid(video.updatedAt)).to.be.true 431 expect(dateIsValid(video.updatedAt)).to.be.true
431 432
432 const res = await getVideo(url, video.uuid) 433 const res = await getVideo(url, video.uuid)