jest-matcher-called-on

1.0.1 • Public • Published

Jest Matcher calledOn

A Jest custom matcher that asserts a Spy or Stub was called on a given context, like sinon.calledOn

Usage

$ npm i jest-matcher-called-on

In <rootDir>/jest/customMatchers.js add the following

import calledOn from 'jest-matcher-called-on';

expect.extend(calledOn);

Then in ./package.json add

"jest": {
  "setupTestFrameworkScriptFile": "<rootDir>/jest/customMatchers.js"
}

And use in your tests like

expect(spy).calledOn(obj);

Scripts

$ npm t
$ npm run lint

Contributions and comments welcome.

Package Sidebar

Install

npm i jest-matcher-called-on

Weekly Downloads

1

Version

1.0.1

License

MIT

Unpacked Size

8.02 kB

Total Files

9

Last publish

Collaborators

  • josephchapman