aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/utils/jobs.ts
blob: 0a8c51575f3376fdeb2b09f630e8da4badbd291c (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
import * as request from 'supertest'

function getJobsList (url: string, accessToken: string) {
  const path = '/api/v1/jobs'

  return request(url)
          .get(path)
          .set('Accept', 'application/json')
          .set('Authorization', 'Bearer ' + accessToken)
          .expect(200)
          .expect('Content-Type', /json/)
}

function getJobsListPaginationAndSort (url: string, accessToken: string, start: number, count: number, sort: string) {
  const path = '/api/v1/jobs'

  return request(url)
          .get(path)
          .query({ start })
          .query({ count })
          .query({ sort })
          .set('Accept', 'application/json')
          .set('Authorization', 'Bearer ' + accessToken)
          .expect(200)
          .expect('Content-Type', /json/)
}

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

export {
  getJobsList,
  getJobsListPaginationAndSort
}