chai-spies-next
Advanced tools
Comparing version 0.9.1 to 0.9.2
@@ -61,3 +61,3 @@ !function (context, definition) { | ||
* const [push, pop] = spy.on(array, ['push', 'pop']); | ||
* | ||
* | ||
* spy.on(array, 'push', returns => 1) | ||
@@ -240,3 +240,3 @@ * | ||
}; | ||
proxy.__spy = { | ||
@@ -248,2 +248,17 @@ calls: [] | ||
/** | ||
* # proxy.reset (function) | ||
* | ||
* Resets spy's state object parameters for instantiation and reuse | ||
* @returns proxy spy object | ||
*/ | ||
proxy.reset = function() { | ||
this.__spy = { | ||
calls: [] | ||
, called: false | ||
, name: name | ||
}; | ||
return this; | ||
} | ||
return proxy; | ||
@@ -250,0 +265,0 @@ } |
@@ -45,3 +45,3 @@ /*! | ||
* const [push, pop] = spy.on(array, ['push', 'pop']); | ||
* | ||
* | ||
* spy.on(array, 'push', returns => 1) | ||
@@ -224,3 +224,3 @@ * | ||
}; | ||
proxy.__spy = { | ||
@@ -232,2 +232,17 @@ calls: [] | ||
/** | ||
* # proxy.reset (function) | ||
* | ||
* Resets spy's state object parameters for instantiation and reuse | ||
* @returns proxy spy object | ||
*/ | ||
proxy.reset = function() { | ||
this.__spy = { | ||
calls: [] | ||
, called: false | ||
, name: name | ||
}; | ||
return this; | ||
} | ||
return proxy; | ||
@@ -234,0 +249,0 @@ } |
@@ -15,3 +15,3 @@ { | ||
], | ||
"version": "0.9.1", | ||
"version": "0.9.2", | ||
"license": "MIT", | ||
@@ -18,0 +18,0 @@ "repository": { |
@@ -504,2 +504,32 @@ if (!chai) { | ||
describe('reset method', function () { | ||
it('should reset spy object values to defaults when called', function() { | ||
var name = 'proxy'; | ||
var spy = chai.spy(name); | ||
spy(); | ||
spy.should.have.been.called(); | ||
spy.__spy.called.should.be.true; | ||
spy.__spy.calls.should.have.length(1); | ||
spy.__spy.name.should.be.equal(name); | ||
spy.reset(); | ||
spy.should.not.have.been.called(); | ||
spy.__spy.called.should.be.false; | ||
spy.__spy.calls.should.have.length(0); | ||
spy.__spy.name.should.be.equal(name); | ||
}); | ||
it('should setup spy with default values when spy is instantiated', function() { | ||
var name = 'proxy'; | ||
var spy = chai.spy(name); | ||
spy.should.be.spy; | ||
spy.__spy.called.should.be.false; | ||
spy.__spy.calls.should.have.length(0); | ||
spy.__spy.name.should.be.equal(name); | ||
}); | ||
}); | ||
describe('spy restore', function () { | ||
@@ -506,0 +536,0 @@ var array; |
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
73725
1751