Comparing version 0.1.13 to 0.1.14
@@ -88,2 +88,7 @@ /* | ||
function reset() { | ||
timesCalled = 0; | ||
calledWithArgs = {}; | ||
} | ||
function call() { | ||
@@ -99,2 +104,3 @@ calledWithArgs[timesCalled++] = arguments; | ||
twice: calledTwice, | ||
reset: reset, | ||
withArgs: withArgs | ||
@@ -101,0 +107,0 @@ }, |
{ | ||
"name": "deride", | ||
"description": "Mocking library based on composition", | ||
"version": "0.1.13", | ||
"version": "0.1.14", | ||
"homepage": "https://github.com/REAANDREW/deride", | ||
@@ -6,0 +6,0 @@ "author": { |
@@ -35,2 +35,5 @@ # deride [![Build Status](https://travis-ci.org/REAANDREW/deride.svg?branch=master)](https://travis-ci.org/REAANDREW/deride) [![NPM version](https://badge.fury.io/js/deride.svg)](http://badge.fury.io/js/deride) [![Dependency Status](https://david-dm.org/REAANDREW/deride.svg)](https://david-dm.org/REAANDREW/deride) | ||
### Resetting the counts / called with args | ||
- ```obj```.expect.```method```.called.reset() | ||
### Setup | ||
@@ -37,0 +40,0 @@ |
@@ -107,2 +107,33 @@ /* | ||
describe('Single function', function() { | ||
it('Resetting the called count', function(done) { | ||
var MyClass = function() { | ||
return { | ||
doStuff: function() {} | ||
}; | ||
}; | ||
var myClass = deride.wrap(new MyClass()); | ||
myClass.doStuff(); | ||
myClass.expect.doStuff.called.once(); | ||
myClass.expect.doStuff.called.reset(); | ||
myClass.expect.doStuff.called.never(); | ||
done(); | ||
}); | ||
it('Resetting the called with count', function(done) { | ||
var MyClass = function() { | ||
return { | ||
doStuff: function() {} | ||
}; | ||
}; | ||
var myClass = deride.wrap(new MyClass()); | ||
myClass.doStuff('test'); | ||
myClass.expect.doStuff.called.withArgs('test'); | ||
myClass.expect.doStuff.called.reset(); | ||
/* jshint immed: false */ | ||
(function() { | ||
myClass.expect.doStuff.called.withArgs('test'); | ||
}).should.throw('false == true'); | ||
done(); | ||
}); | ||
it('can setup a return value', function(done) { | ||
@@ -109,0 +140,0 @@ var func = deride.func(); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
36891
746
288