Fix jobs tests
authorChocobozzz <me@florianbigard.com>
Wed, 19 Sep 2018 15:42:16 +0000 (17:42 +0200)
committerChocobozzz <me@florianbigard.com>
Wed, 19 Sep 2018 15:42:16 +0000 (17:42 +0200)
server/helpers/custom-validators/video-ownership.ts
server/tests/api/server/jobs.ts

index aaa0c736b34c4e73e69270a6bbf40295061960ff..a7771e07b2e0bf6b1266e42407e27588f90e1b75 100644 (file)
@@ -31,7 +31,7 @@ export function checkUserCanTerminateOwnershipChange (
   videoChangeOwnership: VideoChangeOwnershipModel,
   res: Response
 ): boolean {
-  if (videoChangeOwnership.NextOwner.userId === user.Account.userId) {
+  if (videoChangeOwnership.NextOwner.userId === user.id) {
     return true
   }
 
index b2922c5da73d1ba25212f03e5e0c67575b5fe3a1..f5a19c5ea9ec2577ab9dc6fd72695bc6458b96bf 100644 (file)
@@ -45,7 +45,9 @@ describe('Test jobs', function () {
     expect(res.body.total).to.be.above(2)
     expect(res.body.data).to.have.lengthOf(1)
 
-    const job = res.body.data[0]
+    let job = res.body.data[0]
+    // Skip repeat jobs
+    if (job.type === 'videos-views') job = res.body.data[1]
 
     expect(job.state).to.equal('completed')
     expect(job.type).to.equal('activitypub-follow')