@djforth/jest-call-helpers

1.3.0 • Public • Published

jasmine-call-helpers

A call helper designed to work with @djforth/stubs-spy-manager

Install:

yarn -D @djforth/jasmine-call-helpers

Set up

import SpyManager from '@djforth/stubs-spy-manager';
import JasmineCallHelper from '@djforth/jasmine-call-helpers'
import MyModule from './path/to/my_module';

let spies_stubs = SpyManager(MyModule);
let callHelper = JasmineCallHelper(spies_stubs);

describe('My Tests', ()=>{
  beforeEach(()=>{
    spies_stubs.add([
      {
        stub: 'bar'
      }
      , {
        stub: 'foo'
      }
    ]).make();

    MyModule(); //Assuming foo and bar are called
  });

  afterEach(()=>{
    spies_stubs.reset();
  });

  let calls = [
    ['foo', ()=>['some attribute']]
    , ['bar', ()=>['some attribute']]
  ];
  callHelper.add(calls);
  callHelper.checkCalls();
  callHelper.reset();
})

Readme

Keywords

none

Package Sidebar

Install

npm i @djforth/jest-call-helpers

Weekly Downloads

10

Version

1.3.0

License

MIT

Last publish

Collaborators

  • djforth