Skip to content

MGDIS/mgspy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MgSpy

Simple spy function for unit testing

Install

npm install mgspy

Usage

const makeSpy = require('mgspy');

// Tested function
function tested(callMe) {
  callMe("test");
}

it("Should call 'callMe' with one argument", () => {
  const mockCallMe = makeSpy();
  tested(mockCallMe);

  expect(mockCallMe.called).to.equal(true);
  expect(mockCallMe.lastArguments.length).to.equal(1);
  expect(mockCallMe.lastArguments[0]).to.equal("test");
})

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published