hamjest-spy

4.0.0 • Public • Published

hamjest-spy

The simplest spy, providing simple hamjest matchers.

  import { assertThat, not } from 'hamjest';
  import { buildFunctionSpy, wasCalled } from 'hamjest-spy';
  
  describe('Hamjest-spy', () => {
    it('provides `buildFunctionSpy()` to build a spy, and `wasCalled()` is the matcher that can test the spies result', () => {
      const f = buildFunctionSpy(); // <<<<< `buildFunctionSpy()` by hamjest-spy
      f();
      assertThat(f, wasCalled());   // <<<<< `wasCalled()` by hamjest-spy
    });
  });

What is hamjest?

Hamjest is a great non-intrusive set of matcher functions, that allow to combine matchers and make really readable tests.

How to use?

See the tests for how I use the spy and the according matchers.

Development

Install

  • npm install

Testing

  • npm test

How to release?

  • upgrade the version (only major versions)
  • run npm publish (npm run publish doesn't work)

Readme

Keywords

Package Sidebar

Install

npm i hamjest-spy

Weekly Downloads

20

Version

4.0.0

License

MIT

Last publish

Collaborators

  • wolframkriesing