Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@universal-packages/background-jobs-jest

Package Overview
Dependencies
Maintainers
0
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@universal-packages/background-jobs-jest

Jest matchers for Background Jobs

  • 1.1.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
480
increased by49.53%
Maintainers
0
Weekly downloads
 
Created
Source

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.

FAQs

Package last updated on 09 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc