
We'll use it as cache in the future. /!\ You'll loose your old jobs (pending jobs too) so upgrade only when you don't have pending job anymore.
35 lines
1.0 KiB
TypeScript
35 lines
1.0 KiB
TypeScript
import * as request from 'supertest'
|
|
import { JobState } from '../../../../shared/models'
|
|
|
|
function getJobsList (url: string, accessToken: string, state: JobState) {
|
|
const path = '/api/v1/jobs/' + state
|
|
|
|
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, state: JobState, start: number, count: number, sort: string) {
|
|
const path = '/api/v1/jobs/' + state
|
|
|
|
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
|
|
}
|