diff options
Diffstat (limited to 'server/tests/api/check-params')
-rw-r--r-- | server/tests/api/check-params/search.ts | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/server/tests/api/check-params/search.ts b/server/tests/api/check-params/search.ts index a3da54e1f..72ad6c842 100644 --- a/server/tests/api/check-params/search.ts +++ b/server/tests/api/check-params/search.ts | |||
@@ -57,7 +57,7 @@ describe('Test videos API validator', function () { | |||
57 | await checkBadSortPagination(server.url, path, null, query) | 57 | await checkBadSortPagination(server.url, path, null, query) |
58 | }) | 58 | }) |
59 | 59 | ||
60 | it('Should success with the correct parameters', async function () { | 60 | it('Should succeed with the correct parameters', async function () { |
61 | await makeGetRequest({ url: server.url, path, query, expectedStatus: HttpStatusCode.OK_200 }) | 61 | await makeGetRequest({ url: server.url, path, query, expectedStatus: HttpStatusCode.OK_200 }) |
62 | }) | 62 | }) |
63 | 63 | ||
@@ -136,13 +136,24 @@ describe('Test videos API validator', function () { | |||
136 | const customQuery4 = { ...query, originallyPublishedEndDate: 'hello' } | 136 | const customQuery4 = { ...query, originallyPublishedEndDate: 'hello' } |
137 | await makeGetRequest({ url: server.url, path, query: customQuery4, expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) | 137 | await makeGetRequest({ url: server.url, path, query: customQuery4, expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) |
138 | }) | 138 | }) |
139 | |||
140 | it('Should fail with an invalid host', async function () { | ||
141 | const customQuery = { ...query, host: '6565' } | ||
142 | await makeGetRequest({ url: server.url, path, query: customQuery, expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) | ||
143 | }) | ||
144 | |||
145 | it('Should succeed with a host', async function () { | ||
146 | const customQuery = { ...query, host: 'example.com' } | ||
147 | await makeGetRequest({ url: server.url, path, query: customQuery, expectedStatus: HttpStatusCode.OK_200 }) | ||
148 | }) | ||
139 | }) | 149 | }) |
140 | 150 | ||
141 | describe('When searching video playlists', function () { | 151 | describe('When searching video playlists', function () { |
142 | const path = '/api/v1/search/video-playlists/' | 152 | const path = '/api/v1/search/video-playlists/' |
143 | 153 | ||
144 | const query = { | 154 | const query = { |
145 | search: 'coucou' | 155 | search: 'coucou', |
156 | host: 'example.com' | ||
146 | } | 157 | } |
147 | 158 | ||
148 | it('Should fail with a bad start pagination', async function () { | 159 | it('Should fail with a bad start pagination', async function () { |
@@ -157,7 +168,11 @@ describe('Test videos API validator', function () { | |||
157 | await checkBadSortPagination(server.url, path, null, query) | 168 | await checkBadSortPagination(server.url, path, null, query) |
158 | }) | 169 | }) |
159 | 170 | ||
160 | it('Should success with the correct parameters', async function () { | 171 | it('Should fail with an invalid host', async function () { |
172 | await makeGetRequest({ url: server.url, path, query: { ...query, host: '6565' }, expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) | ||
173 | }) | ||
174 | |||
175 | it('Should succeed with the correct parameters', async function () { | ||
161 | await makeGetRequest({ url: server.url, path, query, expectedStatus: HttpStatusCode.OK_200 }) | 176 | await makeGetRequest({ url: server.url, path, query, expectedStatus: HttpStatusCode.OK_200 }) |
162 | }) | 177 | }) |
163 | }) | 178 | }) |
@@ -166,7 +181,8 @@ describe('Test videos API validator', function () { | |||
166 | const path = '/api/v1/search/video-channels/' | 181 | const path = '/api/v1/search/video-channels/' |
167 | 182 | ||
168 | const query = { | 183 | const query = { |
169 | search: 'coucou' | 184 | search: 'coucou', |
185 | host: 'example.com' | ||
170 | } | 186 | } |
171 | 187 | ||
172 | it('Should fail with a bad start pagination', async function () { | 188 | it('Should fail with a bad start pagination', async function () { |
@@ -181,7 +197,11 @@ describe('Test videos API validator', function () { | |||
181 | await checkBadSortPagination(server.url, path, null, query) | 197 | await checkBadSortPagination(server.url, path, null, query) |
182 | }) | 198 | }) |
183 | 199 | ||
184 | it('Should success with the correct parameters', async function () { | 200 | it('Should fail with an invalid host', async function () { |
201 | await makeGetRequest({ url: server.url, path, query: { ...query, host: '6565' }, expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) | ||
202 | }) | ||
203 | |||
204 | it('Should succeed with the correct parameters', async function () { | ||
185 | await makeGetRequest({ url: server.url, path, query, expectedStatus: HttpStatusCode.OK_200 }) | 205 | await makeGetRequest({ url: server.url, path, query, expectedStatus: HttpStatusCode.OK_200 }) |
186 | }) | 206 | }) |
187 | }) | 207 | }) |