aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/utils/requests/check-api-params.ts
blob: edb47e0e96dd092ff20e6a18e76af50698dad158 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import { makeGetRequest } from './requests'
import { immutableAssign } from '..'

function checkBadStartPagination (url: string, path: string, token?: string, query = {}) {
  return makeGetRequest({
    url,
    path,
    token,
    query: immutableAssign(query, { start: 'hello' }),
    statusCodeExpected: 400
  })
}

function checkBadCountPagination (url: string, path: string, token?: string, query = {}) {
  return makeGetRequest({
    url,
    path,
    token,
    query: immutableAssign(query, { count: 'hello' }),
    statusCodeExpected: 400
  })
}

function checkBadSortPagination (url: string, path: string, token?: string, query = {}) {
  return makeGetRequest({
    url,
    path,
    token,
    query: immutableAssign(query, { sort: 'hello' }),
    statusCodeExpected: 400
  })
}

// ---------------------------------------------------------------------------

export {
  checkBadStartPagination,
  checkBadCountPagination,
  checkBadSortPagination
}