aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api')
-rw-r--r--server/tests/api/users/user-subscriptions.ts32
-rw-r--r--server/tests/api/videos/video-channels.ts26
2 files changed, 56 insertions, 2 deletions
diff --git a/server/tests/api/users/user-subscriptions.ts b/server/tests/api/users/user-subscriptions.ts
index 7d6b0c6a9..60676a37b 100644
--- a/server/tests/api/users/user-subscriptions.ts
+++ b/server/tests/api/users/user-subscriptions.ts
@@ -96,14 +96,14 @@ describe('Test users subscriptions', function () {
96 96
97 it('Should list subscriptions', async function () { 97 it('Should list subscriptions', async function () {
98 { 98 {
99 const res = await listUserSubscriptions(servers[0].url, servers[0].accessToken) 99 const res = await listUserSubscriptions({ url: servers[0].url, token: servers[0].accessToken })
100 expect(res.body.total).to.equal(0) 100 expect(res.body.total).to.equal(0)
101 expect(res.body.data).to.be.an('array') 101 expect(res.body.data).to.be.an('array')
102 expect(res.body.data).to.have.lengthOf(0) 102 expect(res.body.data).to.have.lengthOf(0)
103 } 103 }
104 104
105 { 105 {
106 const res = await listUserSubscriptions(servers[0].url, users[0].accessToken, 'createdAt') 106 const res = await listUserSubscriptions({ url: servers[0].url, token: users[0].accessToken, sort: 'createdAt' })
107 expect(res.body.total).to.equal(2) 107 expect(res.body.total).to.equal(2)
108 108
109 const subscriptions: VideoChannel[] = res.body.data 109 const subscriptions: VideoChannel[] = res.body.data
@@ -156,6 +156,34 @@ describe('Test users subscriptions', function () {
156 expect(body['user3_channel@localhost:' + servers[0].port]).to.be.false 156 expect(body['user3_channel@localhost:' + servers[0].port]).to.be.false
157 }) 157 })
158 158
159 it('Should search among subscriptions', async function () {
160 {
161 const res = await listUserSubscriptions({
162 url: servers[0].url,
163 token: users[0].accessToken,
164 sort: '-createdAt',
165 search: 'user3_channel'
166 })
167 expect(res.body.total).to.equal(1)
168
169 const subscriptions = res.body.data
170 expect(subscriptions).to.have.lengthOf(1)
171 }
172
173 {
174 const res = await listUserSubscriptions({
175 url: servers[0].url,
176 token: users[0].accessToken,
177 sort: '-createdAt',
178 search: 'toto'
179 })
180 expect(res.body.total).to.equal(0)
181
182 const subscriptions = res.body.data
183 expect(subscriptions).to.have.lengthOf(0)
184 }
185 })
186
159 it('Should list subscription videos', async function () { 187 it('Should list subscription videos', async function () {
160 { 188 {
161 const res = await listUserSubscriptionVideos(servers[0].url, servers[0].accessToken) 189 const res = await listUserSubscriptionVideos(servers[0].url, servers[0].accessToken)
diff --git a/server/tests/api/videos/video-channels.ts b/server/tests/api/videos/video-channels.ts
index 3493a723d..367f99fdd 100644
--- a/server/tests/api/videos/video-channels.ts
+++ b/server/tests/api/videos/video-channels.ts
@@ -421,6 +421,32 @@ describe('Test video channels', function () {
421 expect(totoChannel.videosCount).to.equal(0) 421 expect(totoChannel.videosCount).to.equal(0)
422 }) 422 })
423 423
424 it('Should search among account video channels', async function () {
425 {
426 const res = await getAccountVideoChannelsList({
427 url: servers[0].url,
428 accountName: userInfo.account.name + '@' + userInfo.account.host,
429 search: 'root'
430 })
431 expect(res.body.total).to.equal(1)
432
433 const channels = res.body.data
434 expect(channels).to.have.lengthOf(1)
435 }
436
437 {
438 const res = await getAccountVideoChannelsList({
439 url: servers[0].url,
440 accountName: userInfo.account.name + '@' + userInfo.account.host,
441 search: 'does not exist'
442 })
443 expect(res.body.total).to.equal(0)
444
445 const channels = res.body.data
446 expect(channels).to.have.lengthOf(0)
447 }
448 })
449
424 after(async function () { 450 after(async function () {
425 await cleanupTests(servers) 451 await cleanupTests(servers)
426 }) 452 })