testdouble
Advanced tools
Comparing version 1.6.0 to 1.6.1
# Change Log | ||
## [v1.6.1](https://github.com/testdouble/testdouble.js/tree/v1.6.1) (2016-08-31) | ||
[Full Changelog](https://github.com/testdouble/testdouble.js/compare/v1.6.0...v1.6.1) | ||
**Closed issues:** | ||
- td.explain should indicate thenCallback / thenResolve / thenReject from thenReturn [\#126](https://github.com/testdouble/testdouble.js/issues/126) | ||
- td.when and td.verify warning [\#125](https://github.com/testdouble/testdouble.js/issues/125) | ||
- td.callback, when given a td.object, raises a TypeError [\#124](https://github.com/testdouble/testdouble.js/issues/124) | ||
- not matcher and calling function multiple times [\#122](https://github.com/testdouble/testdouble.js/issues/122) | ||
- Verify of a specific call when multiple calls happen [\#120](https://github.com/testdouble/testdouble.js/issues/120) | ||
**Merged pull requests:** | ||
- explain plan better in stubbing description [\#127](https://github.com/testdouble/testdouble.js/pull/127) ([Moeriki](https://github.com/Moeriki)) | ||
- Fix typo in plugin name [\#123](https://github.com/testdouble/testdouble.js/pull/123) ([hanneskaeufler](https://github.com/hanneskaeufler)) | ||
## [v1.6.0](https://github.com/testdouble/testdouble.js/tree/v1.6.0) (2016-07-14) | ||
@@ -4,0 +20,0 @@ [Full Changelog](https://github.com/testdouble/testdouble.js/compare/v1.5.0...v1.6.0) |
@@ -34,2 +34,6 @@ # Plugins | ||
testdouble.js by Ember projects that using Ember CLI | ||
* [karma-testdouble](https://github.com/kahwee/karma-testdouble) by | ||
[@kahwee](https://github.com/kahwee) will configure | ||
[Karma](https://karma-runner.github.io) to load test double's browser | ||
distribution | ||
@@ -36,0 +40,0 @@ ## Fake Timers |
@@ -58,2 +58,41 @@ // Generated by CoffeeScript 1.10.0 | ||
}); | ||
context('a double with callback', function() { | ||
Given(function() { | ||
return td.when(this.testDouble(14)).thenCallback(null, 8); | ||
}); | ||
return Then(function() { | ||
return expect(this.result).to.deep.eq({ | ||
calls: [], | ||
callCount: 0, | ||
description: "This test double has 1 stubbings and 0 invocations.\n\nStubbings:\n - when called with `(14, callback)`, then callback `(null, 8)`.", | ||
isTestDouble: true | ||
}); | ||
}); | ||
}); | ||
context('a double with resolve', function() { | ||
Given(function() { | ||
return td.when(this.testDouble(14)).thenResolve(8); | ||
}); | ||
return Then(function() { | ||
return expect(this.result).to.deep.eq({ | ||
calls: [], | ||
callCount: 0, | ||
description: "This test double has 1 stubbings and 0 invocations.\n\nStubbings:\n - when called with `(14)`, then resolve `8`.", | ||
isTestDouble: true | ||
}); | ||
}); | ||
}); | ||
context('a double with reject', function() { | ||
Given(function() { | ||
return td.when(this.testDouble(14)).thenReject(8); | ||
}); | ||
return Then(function() { | ||
return expect(this.result).to.deep.eq({ | ||
calls: [], | ||
callCount: 0, | ||
description: "This test double has 1 stubbings and 0 invocations.\n\nStubbings:\n - when called with `(14)`, then reject `8`.", | ||
isTestDouble: true | ||
}); | ||
}); | ||
}); | ||
return context('passed a non-test double', function() { | ||
@@ -60,0 +99,0 @@ Given(function() { |
@@ -48,3 +48,24 @@ // Generated by CoffeeScript 1.10.0 | ||
return _.reduce(stubs, function(desc, stub) { | ||
return desc + ("\n - when called with `(" + (stringifyArgs(stub.args)) + ")`, then return " + (stringifyArgs(stub.stubbedValues, ", then ", "`")) + "."); | ||
var args, plan; | ||
plan = (function() { | ||
switch (stub.config.plan) { | ||
case 'thenCallback': | ||
return 'callback'; | ||
case 'thenResolve': | ||
return 'resolve'; | ||
case 'thenReject': | ||
return 'reject'; | ||
default: | ||
return 'return'; | ||
} | ||
})(); | ||
args = (function() { | ||
switch (stub.config.plan) { | ||
case 'thenCallback': | ||
return "`(" + (stringifyArgs(stub.stubbedValues, ", ")) + ")`"; | ||
default: | ||
return stringifyArgs(stub.stubbedValues, ", then ", "`"); | ||
} | ||
})(); | ||
return desc + ("\n - when called with `(" + (stringifyArgs(stub.args)) + ")`, then " + plan + " " + args + "."); | ||
}, "\n\nStubbings:"); | ||
@@ -51,0 +72,0 @@ }; |
// Generated by CoffeeScript 1.10.0 | ||
(function() { | ||
module.exports = '1.6.0'; | ||
module.exports = '1.6.1'; | ||
}).call(this); |
{ | ||
"name": "testdouble", | ||
"version": "1.6.0", | ||
"version": "1.6.1", | ||
"description": "A minimal test double library for TDD with JavaScript", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/testdouble/testdouble.js", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
801737
17752