Skip to content

yotamlaufer/mockeasy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MockEasy

MockEasy is a simple yet powerful mocking library for NodeJS.

A good use case for this library is mocking data access objects in tests, negating the use of a database.

Example

// math.js
exports.increment = function(value) {
  return value++;
}
// test.js
const mockeasy = require('mockeasy');
const mockedMath = mockeasy.stub(require('./math'));

mockedMath.increment.once(function(value) {
  return 100;
});

console.log(mockedMath.increment());
// 100

console.log(mockedMath.increment());
// throws error

Releases

No releases published

Packages

No packages published