diff options
author | Chocobozzz <me@florianbigard.com> | 2021-07-29 10:27:24 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-07-29 10:27:24 +0200 |
commit | b033851fb54241bb703f86add025229e68cc6f59 (patch) | |
tree | d60dac1499a95bf9dc902dee24f325fe0f8b6acb /server/tests | |
parent | fbd67e7f386504e50f2504cb6386700a58906f16 (diff) | |
download | PeerTube-b033851fb54241bb703f86add025229e68cc6f59.tar.gz PeerTube-b033851fb54241bb703f86add025229e68cc6f59.tar.zst PeerTube-b033851fb54241bb703f86add025229e68cc6f59.zip |
Search channels against handles and not names
Diffstat (limited to 'server/tests')
-rw-r--r-- | server/tests/api/check-params/search.ts | 4 | ||||
-rw-r--r-- | server/tests/api/search/search-channels.ts | 17 |
2 files changed, 16 insertions, 5 deletions
diff --git a/server/tests/api/check-params/search.ts b/server/tests/api/check-params/search.ts index 789ea7754..cc15d2593 100644 --- a/server/tests/api/check-params/search.ts +++ b/server/tests/api/check-params/search.ts | |||
@@ -216,6 +216,10 @@ describe('Test videos API validator', function () { | |||
216 | await makeGetRequest({ url: server.url, path, query: { ...query, host: '6565' }, expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) | 216 | await makeGetRequest({ url: server.url, path, query: { ...query, host: '6565' }, expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) |
217 | }) | 217 | }) |
218 | 218 | ||
219 | it('Should fail with invalid handles', async function () { | ||
220 | await makeGetRequest({ url: server.url, path, query: { ...query, handles: [ '' ] }, expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) | ||
221 | }) | ||
222 | |||
219 | it('Should succeed with the correct parameters', async function () { | 223 | it('Should succeed with the correct parameters', async function () { |
220 | await makeGetRequest({ url: server.url, path, query, expectedStatus: HttpStatusCode.OK_200 }) | 224 | await makeGetRequest({ url: server.url, path, query, expectedStatus: HttpStatusCode.OK_200 }) |
221 | }) | 225 | }) |
diff --git a/server/tests/api/search/search-channels.ts b/server/tests/api/search/search-channels.ts index ef78c0f67..4485c424e 100644 --- a/server/tests/api/search/search-channels.ts +++ b/server/tests/api/search/search-channels.ts | |||
@@ -122,18 +122,25 @@ describe('Test channels search', function () { | |||
122 | 122 | ||
123 | it('Should filter by names', async function () { | 123 | it('Should filter by names', async function () { |
124 | { | 124 | { |
125 | const body = await command.advancedChannelSearch({ search: { names: [ 'squall_channel', 'zell_channel' ] } }) | 125 | const body = await command.advancedChannelSearch({ search: { handles: [ 'squall_channel', 'zell_channel' ] } }) |
126 | expect(body.total).to.equal(2) | 126 | expect(body.total).to.equal(1) |
127 | expect(body.data).to.have.lengthOf(2) | 127 | expect(body.data).to.have.lengthOf(1) |
128 | expect(body.data[0].displayName).to.equal('Squall channel') | 128 | expect(body.data[0].displayName).to.equal('Squall channel') |
129 | expect(body.data[1].displayName).to.equal('Zell channel') | ||
130 | } | 129 | } |
131 | 130 | ||
132 | { | 131 | { |
133 | const body = await command.advancedChannelSearch({ search: { names: [ 'chocobozzz_channel' ] } }) | 132 | const body = await command.advancedChannelSearch({ search: { handles: [ 'chocobozzz_channel' ] } }) |
134 | expect(body.total).to.equal(0) | 133 | expect(body.total).to.equal(0) |
135 | expect(body.data).to.have.lengthOf(0) | 134 | expect(body.data).to.have.lengthOf(0) |
136 | } | 135 | } |
136 | |||
137 | { | ||
138 | const body = await command.advancedChannelSearch({ search: { handles: [ 'squall_channel', 'zell_channel@' + remoteServer.host ] } }) | ||
139 | expect(body.total).to.equal(2) | ||
140 | expect(body.data).to.have.lengthOf(2) | ||
141 | expect(body.data[0].displayName).to.equal('Squall channel') | ||
142 | expect(body.data[1].displayName).to.equal('Zell channel') | ||
143 | } | ||
137 | }) | 144 | }) |
138 | 145 | ||
139 | after(async function () { | 146 | after(async function () { |