]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - shared/extra-utils/requests/check-api-params.ts
Centralize test URLs
[github/Chocobozzz/PeerTube.git] / shared / extra-utils / requests / check-api-params.ts
index c34c7c216865b6b46f848d710886445e68c0d907..7df63b0044c0a4a2141c90f47364f0befef97fb3 100644 (file)
@@ -1,13 +1,13 @@
+import { HttpStatusCode } from '@shared/core-utils'
 import { makeGetRequest } from './requests'
-import { immutableAssign } from '../miscs/miscs'
 
 function checkBadStartPagination (url: string, path: string, token?: string, query = {}) {
   return makeGetRequest({
     url,
     path,
     token,
-    query: immutableAssign(query, { start: 'hello' }),
-    statusCodeExpected: 400
+    query: { ...query, start: 'hello' },
+    statusCodeExpected: HttpStatusCode.BAD_REQUEST_400
   })
 }
 
@@ -16,16 +16,16 @@ async function checkBadCountPagination (url: string, path: string, token?: strin
     url,
     path,
     token,
-    query: immutableAssign(query, { count: 'hello' }),
-    statusCodeExpected: 400
+    query: { ...query, count: 'hello' },
+    statusCodeExpected: HttpStatusCode.BAD_REQUEST_400
   })
 
   await makeGetRequest({
     url,
     path,
     token,
-    query: immutableAssign(query, { count: 2000 }),
-    statusCodeExpected: 400
+    query: { ...query, count: 2000 },
+    statusCodeExpected: HttpStatusCode.BAD_REQUEST_400
   })
 }
 
@@ -34,8 +34,8 @@ function checkBadSortPagination (url: string, path: string, token?: string, quer
     url,
     path,
     token,
-    query: immutableAssign(query, { sort: 'hello' }),
-    statusCodeExpected: 400
+    query: { ...query, sort: 'hello' },
+    statusCodeExpected: HttpStatusCode.BAD_REQUEST_400
   })
 }