aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/jobs.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2017-12-28 13:59:22 +0100
committerChocobozzz <me@florianbigard.com>2017-12-28 13:59:22 +0100
commitc5d31dba56d669c0df0209761c43c5a6ac7cec4a (patch)
treefe72b56a1c0e7beb6e092c393a00ddfe93a5d71f /server/tests/api/jobs.ts
parentdb799da3d2b2ea465165df78ff71effa653b6309 (diff)
downloadPeerTube-c5d31dba56d669c0df0209761c43c5a6ac7cec4a.tar.gz
PeerTube-c5d31dba56d669c0df0209761c43c5a6ac7cec4a.tar.zst
PeerTube-c5d31dba56d669c0df0209761c43c5a6ac7cec4a.zip
Tests directories refractor
Diffstat (limited to 'server/tests/api/jobs.ts')
-rw-r--r--server/tests/api/jobs.ts64
1 files changed, 0 insertions, 64 deletions
diff --git a/server/tests/api/jobs.ts b/server/tests/api/jobs.ts
deleted file mode 100644
index 4d9b61392..000000000
--- a/server/tests/api/jobs.ts
+++ /dev/null
@@ -1,64 +0,0 @@
1/* tslint:disable:no-unused-expression */
2
3import * as chai from 'chai'
4import 'mocha'
5import { flushTests, killallServers, ServerInfo, setAccessTokensToServers, wait } from '../utils'
6import { doubleFollow } from '../utils/follows'
7import { getJobsList, getJobsListPaginationAndSort } from '../utils/jobs'
8import { flushAndRunMultipleServers } from '../utils/servers'
9import { uploadVideo } from '../utils/videos'
10import { dateIsValid } from '../utils/miscs'
11
12const expect = chai.expect
13
14describe('Test jobs', function () {
15 let servers: ServerInfo[]
16
17 before(async function () {
18 this.timeout(30000)
19
20 servers = await flushAndRunMultipleServers(2)
21
22 await setAccessTokensToServers(servers)
23
24 // Server 1 and server 2 follow each other
25 await doubleFollow(servers[0], servers[1])
26 })
27
28 it('Should create some jobs', async function () {
29 this.timeout(30000)
30
31 await uploadVideo(servers[1].url, servers[1].accessToken, { name: 'video1' })
32 await uploadVideo(servers[1].url, servers[1].accessToken, { name: 'video2' })
33
34 await wait(15000)
35 })
36
37 it('Should list jobs', async function () {
38 const res = await getJobsList(servers[1].url, servers[1].accessToken)
39 expect(res.body.total).to.be.above(2)
40 expect(res.body.data).to.have.length.above(2)
41 })
42
43 it('Should list jobs with sort and pagination', async function () {
44 const res = await getJobsListPaginationAndSort(servers[1].url, servers[1].accessToken, 4, 1, 'createdAt')
45 expect(res.body.total).to.be.above(2)
46 expect(res.body.data).to.have.lengthOf(1)
47
48 const job = res.body.data[0]
49 expect(job.state).to.equal('success')
50 expect(job.category).to.equal('transcoding')
51 expect(job.handlerName).to.have.length.above(3)
52 expect(dateIsValid(job.createdAt)).to.be.true
53 expect(dateIsValid(job.updatedAt)).to.be.true
54 })
55
56 after(async function () {
57 killallServers(servers)
58
59 // Keep the logs if the test failed
60 if (this['ok']) {
61 await flushTests()
62 }
63 })
64})