+ it('Should sort by originallyPublishedAt', async function () {
+ {
+
+ {
+ const now = new Date()
+ const attributes = { originallyPublishedAt: now.toISOString() }
+ await updateVideo(server.url, server.accessToken, videoId, attributes)
+
+ const res = await getVideosListSort(server.url, '-originallyPublishedAt')
+ const names = res.body.data.map(v => v.name)
+
+ expect(names[0]).to.equal('my super video updated')
+ expect(names[1]).to.equal('video_short2.webm name')
+ expect(names[2]).to.equal('video_short1.webm name')
+ expect(names[3]).to.equal('video_short.webm name')
+ expect(names[4]).to.equal('video_short.ogv name')
+ expect(names[5]).to.equal('video_short.mp4 name')
+ }
+
+ {
+ const now = new Date()
+ const attributes = { originallyPublishedAt: now.toISOString() }
+ await updateVideo(server.url, server.accessToken, videoId2, attributes)
+
+ const res = await getVideosListSort(server.url, '-originallyPublishedAt')
+ const names = res.body.data.map(v => v.name)
+
+ expect(names[0]).to.equal('video_short1.webm name')
+ expect(names[1]).to.equal('my super video updated')
+ expect(names[2]).to.equal('video_short2.webm name')
+ expect(names[3]).to.equal('video_short.webm name')
+ expect(names[4]).to.equal('video_short.ogv name')
+ expect(names[5]).to.equal('video_short.mp4 name')
+ }
+ }
+ })
+
+ after(async function () {
+ await cleanupTests([ server ])