Skip to content

Commit

Permalink
new test related to GH issue
Browse files Browse the repository at this point in the history
  • Loading branch information
timgit committed May 13, 2021
1 parent fdb205b commit a186074
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions test/failureTest.js
@@ -1,6 +1,7 @@
const delay = require('delay')
const assert = require('assert')
const helper = require('./testHelper')
const pMap = require('p-map')

describe('failure', function () {
it('should reject missing id argument', async function () {
Expand Down Expand Up @@ -61,6 +62,26 @@ describe('failure', function () {
await boss.fail(jobs.map(job => job.id))
})

it('should fail a batch of jobs with a data arg', async function () {
const boss = this.test.boss = await helper.start(this.test.bossConfig)
const queue = this.test.bossConfig.schema
const message = 'some error'

await Promise.all([
boss.publish(queue),
boss.publish(queue),
boss.publish(queue)
])

const jobs = await boss.fetch(queue, 3)

await boss.fail(jobs.map(job => job.id), new Error(message))

const results = await pMap(jobs, job => boss.getJobById(job.id))

assert(results.every(i => i.output.message === message))
})

it('should accept a payload', async function () {
const boss = this.test.boss = await helper.start(this.test.bossConfig)

Expand Down

0 comments on commit a186074

Please sign in to comment.