1.1.0 • Published 1 month ago

@universal-packages/background-jobs-jest v1.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 month ago

Background Jobs Jest

npm version Testing codecov

Jest matchers for Background Jobs testing.

Install

npm install @universal-packages/background-jobs-jest

npm install @universal-packages/background-jobs

Setup

Add the following to your jest.config.js or where you configure Jest:

module.exports = {
  setupFilesAfterEnv: ['@universal-packages/background-jobs-jest']
}

Matchers

toHaveBeenEnqueued

import { MyJob } from './MyJob'

it('should enqueue MyJob', async () => {
  await MyJob.performLater()

  expect(MyJob).toHaveBeenEnqueued()
})

toHaveBeenEnqueuedWith

import { MyJob } from './MyJob'

it('should enqueue MyJob with payload', async () => {
  await MyJob.performLater({ id: 1 })

  expect(MyJob).toHaveBeenEnqueuedWith({ id: 1 })
})

Typescript

In order for typescript to see the global types you need to reference the types somewhere in your project, normally ./src/globals.d.ts.

/// <reference types="@universal-packages/background-jobs-jest" />

This library is developed in TypeScript and shipped fully typed.

Contributing

The development of this library happens in the open on GitHub, and we are grateful to the community for contributing bugfixes and improvements. Read below to learn how you can take part in improving this library.

License

MIT licensed.

1.1.0

1 month ago

1.0.19

2 months ago

1.0.21

2 months ago

1.0.20

2 months ago

1.0.18

2 months ago

1.0.17

3 months ago

1.0.16

4 months ago

1.0.15

4 months ago

1.0.14

4 months ago

1.0.2

8 months ago

1.0.9

6 months ago

1.0.8

7 months ago

1.0.7

7 months ago

1.0.6

7 months ago

1.0.5

7 months ago

1.0.4

7 months ago

1.0.3

8 months ago

1.0.11

6 months ago

1.0.10

6 months ago

1.0.13

6 months ago

1.0.12

6 months ago

1.0.1

11 months ago

1.0.0

11 months ago