Skip to content

Fake adapter support and bug fixes

Choose a tag to compare

@RomainLanz RomainLanz released this 20 Jan 18:27
· 47 commits to main since this release
v0.3.2
6402da2

New Features

QueueManager.fake / QueueManager.restore

You can replace all adapters with the fake adapter for test assertions, then restore the original configuration.

import { QueueManager } from '@boringnode/queue'
import { redis } from '@boringnode/queue/drivers/redis_adapter'

await QueueManager.init({
  default: 'redis',
  adapters: {
    redis: redis({ host: 'localhost' }),
  },
})

const fake = QueueManager.fake()

await SendEmailJob.dispatch({ to: 'user@example.com' })

fake.assertPushed(SendEmailJob, {
  queue: 'default',
  payload: { to: 'user@example.com' },
})

QueueManager.restore()

Bug Fixes

Respect maxRetries: 0 in job retry configuration

Fixed a bug where maxRetries: 0 configuration was not properly respected, allowing jobs to retry when they should not. (Closes #3)