check-api-params.ts 976 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import { makeGetRequest } from './requests'
  2. import { immutableAssign } from '../miscs/miscs'
  3. function checkBadStartPagination (url: string, path: string, token?: string, query = {}) {
  4. return makeGetRequest({
  5. url,
  6. path,
  7. token,
  8. query: immutableAssign(query, { start: 'hello' }),
  9. statusCodeExpected: 400
  10. })
  11. }
  12. function checkBadCountPagination (url: string, path: string, token?: string, query = {}) {
  13. return makeGetRequest({
  14. url,
  15. path,
  16. token,
  17. query: immutableAssign(query, { count: 'hello' }),
  18. statusCodeExpected: 400
  19. })
  20. }
  21. function checkBadSortPagination (url: string, path: string, token?: string, query = {}) {
  22. return makeGetRequest({
  23. url,
  24. path,
  25. token,
  26. query: immutableAssign(query, { sort: 'hello' }),
  27. statusCodeExpected: 400
  28. })
  29. }
  30. // ---------------------------------------------------------------------------
  31. export {
  32. checkBadStartPagination,
  33. checkBadCountPagination,
  34. checkBadSortPagination
  35. }