aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-07-10 17:02:20 +0200
committerChocobozzz <me@florianbigard.com>2018-07-11 14:00:17 +0200
commit94831479f5facff9469540a3d49dd347b88bdf5a (patch)
tree4e8990fc4fded913952c732b6466b15fc52ab06d /server/tests/api
parent2cdf27bae6acfaa0b99bb07555edc57f48b8bc43 (diff)
downloadPeerTube-94831479f5facff9469540a3d49dd347b88bdf5a.tar.gz
PeerTube-94831479f5facff9469540a3d49dd347b88bdf5a.tar.zst
PeerTube-94831479f5facff9469540a3d49dd347b88bdf5a.zip
Migrate to bull
Diffstat (limited to 'server/tests/api')
-rw-r--r--server/tests/api/server/handle-down.ts14
-rw-r--r--server/tests/api/server/jobs.ts11
2 files changed, 16 insertions, 9 deletions
diff --git a/server/tests/api/server/handle-down.ts b/server/tests/api/server/handle-down.ts
index 69609b4fc..84d310ae6 100644
--- a/server/tests/api/server/handle-down.ts
+++ b/server/tests/api/server/handle-down.ts
@@ -6,15 +6,21 @@ import { JobState } from '../../../../shared/models'
6import { VideoPrivacy } from '../../../../shared/models/videos' 6import { VideoPrivacy } from '../../../../shared/models/videos'
7import { VideoCommentThreadTree } from '../../../../shared/models/videos/video-comment.model' 7import { VideoCommentThreadTree } from '../../../../shared/models/videos/video-comment.model'
8import { completeVideoCheck, getVideo, immutableAssign, reRunServer, viewVideo } from '../../utils' 8import { completeVideoCheck, getVideo, immutableAssign, reRunServer, viewVideo } from '../../utils'
9
10import { 9import {
11 flushAndRunMultipleServers, flushTests, getVideosList, killallServers, ServerInfo, setAccessTokensToServers, uploadVideo, 10 flushAndRunMultipleServers,
11 getVideosList,
12 killallServers,
13 ServerInfo,
14 setAccessTokensToServers,
15 uploadVideo,
12 wait 16 wait
13} from '../../utils/index' 17} from '../../utils/index'
14import { follow, getFollowersListPaginationAndSort } from '../../utils/server/follows' 18import { follow, getFollowersListPaginationAndSort } from '../../utils/server/follows'
15import { getJobsListPaginationAndSort, waitJobs } from '../../utils/server/jobs' 19import { getJobsListPaginationAndSort, waitJobs } from '../../utils/server/jobs'
16import { 20import {
17 addVideoCommentReply, addVideoCommentThread, getVideoCommentThreads, 21 addVideoCommentReply,
22 addVideoCommentThread,
23 getVideoCommentThreads,
18 getVideoThreadComments 24 getVideoThreadComments
19} from '../../utils/videos/video-comments' 25} from '../../utils/videos/video-comments'
20 26
@@ -146,7 +152,7 @@ describe('Test handle downs', function () {
146 }) 152 })
147 153
148 it('Should not have pending/processing jobs anymore', async function () { 154 it('Should not have pending/processing jobs anymore', async function () {
149 const states: JobState[] = [ 'inactive', 'active' ] 155 const states: JobState[] = [ 'waiting', 'active' ]
150 156
151 for (const state of states) { 157 for (const state of states) {
152 const res = await getJobsListPaginationAndSort(servers[ 0 ].url, servers[ 0 ].accessToken, state,0, 50, '-createdAt') 158 const res = await getJobsListPaginationAndSort(servers[ 0 ].url, servers[ 0 ].accessToken, state,0, 50, '-createdAt')
diff --git a/server/tests/api/server/jobs.ts b/server/tests/api/server/jobs.ts
index 81e389de6..f248c5521 100644
--- a/server/tests/api/server/jobs.ts
+++ b/server/tests/api/server/jobs.ts
@@ -2,7 +2,7 @@
2 2
3import * as chai from 'chai' 3import * as chai from 'chai'
4import 'mocha' 4import 'mocha'
5import { flushTests, killallServers, ServerInfo, setAccessTokensToServers, wait } from '../../utils/index' 5import { killallServers, ServerInfo, setAccessTokensToServers } from '../../utils/index'
6import { doubleFollow } from '../../utils/server/follows' 6import { doubleFollow } from '../../utils/server/follows'
7import { getJobsList, getJobsListPaginationAndSort, waitJobs } from '../../utils/server/jobs' 7import { getJobsList, getJobsListPaginationAndSort, waitJobs } from '../../utils/server/jobs'
8import { flushAndRunMultipleServers } from '../../utils/server/servers' 8import { flushAndRunMultipleServers } from '../../utils/server/servers'
@@ -35,22 +35,23 @@ describe('Test jobs', function () {
35 }) 35 })
36 36
37 it('Should list jobs', async function () { 37 it('Should list jobs', async function () {
38 const res = await getJobsList(servers[1].url, servers[1].accessToken, 'complete') 38 const res = await getJobsList(servers[1].url, servers[1].accessToken, 'completed')
39 expect(res.body.total).to.be.above(2) 39 expect(res.body.total).to.be.above(2)
40 expect(res.body.data).to.have.length.above(2) 40 expect(res.body.data).to.have.length.above(2)
41 }) 41 })
42 42
43 it('Should list jobs with sort and pagination', async function () { 43 it('Should list jobs with sort and pagination', async function () {
44 const res = await getJobsListPaginationAndSort(servers[1].url, servers[1].accessToken, 'complete', 1, 1, 'createdAt') 44 const res = await getJobsListPaginationAndSort(servers[1].url, servers[1].accessToken, 'completed', 1, 1, 'createdAt')
45 expect(res.body.total).to.be.above(2) 45 expect(res.body.total).to.be.above(2)
46 expect(res.body.data).to.have.lengthOf(1) 46 expect(res.body.data).to.have.lengthOf(1)
47 47
48 const job = res.body.data[0] 48 const job = res.body.data[0]
49 49
50 expect(job.state).to.equal('complete') 50 expect(job.state).to.equal('completed')
51 expect(job.type).to.equal('activitypub-http-unicast') 51 expect(job.type).to.equal('activitypub-http-unicast')
52 expect(dateIsValid(job.createdAt)).to.be.true 52 expect(dateIsValid(job.createdAt)).to.be.true
53 expect(dateIsValid(job.updatedAt)).to.be.true 53 expect(dateIsValid(job.processedOn)).to.be.true
54 expect(dateIsValid(job.finishedOn)).to.be.true
54 }) 55 })
55 56
56 after(async function () { 57 after(async function () {