+ it('Should paginate and sort account channels', async function () {
+ {
+ const res = await getAccountVideoChannelsList({
+ url: servers[ 0 ].url,
+ accountName: userInfo.account.name + '@' + userInfo.account.host,
+ start: 0,
+ count: 1,
+ sort: 'createdAt'
+ })
+
+ expect(res.body.total).to.equal(2)
+ expect(res.body.data).to.have.lengthOf(1)
+
+ const videoChannel: VideoChannel = res.body.data[ 0 ]
+ expect(videoChannel.name).to.equal('root_channel')
+ }
+
+ {
+ const res = await getAccountVideoChannelsList({
+ url: servers[ 0 ].url,
+ accountName: userInfo.account.name + '@' + userInfo.account.host,
+ start: 0,
+ count: 1,
+ sort: '-createdAt'
+ })
+
+ expect(res.body.total).to.equal(2)
+ expect(res.body.data).to.have.lengthOf(1)
+
+ const videoChannel: VideoChannel = res.body.data[ 0 ]
+ expect(videoChannel.name).to.equal('second_video_channel')
+ }
+
+ {
+ const res = await getAccountVideoChannelsList({
+ url: servers[ 0 ].url,
+ accountName: userInfo.account.name + '@' + userInfo.account.host,
+ start: 1,
+ count: 1,
+ sort: '-createdAt'
+ })
+
+ expect(res.body.total).to.equal(2)
+ expect(res.body.data).to.have.lengthOf(1)
+
+ const videoChannel: VideoChannel = res.body.data[ 0 ]
+ expect(videoChannel.name).to.equal('root_channel')
+ }
+ })
+