Skip to content

Commit

Permalink
Migrate to sinon 1.9.
Browse files Browse the repository at this point in the history
  • Loading branch information
MathieuTurcotte committed Mar 9, 2014
1 parent 4362823 commit 2e0d6c7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -13,7 +13,7 @@
"precond": "0.2"
},
"devDependencies": {
"sinon": "1.7",
"sinon": "1.9",
"nodeunit": "0.8",
"jshint": "2.4",
"docco": "0.6"
Expand Down
25 changes: 17 additions & 8 deletions tests/function_call.js
Expand Up @@ -48,7 +48,9 @@ exports["FunctionCall"] = {
},

"isPending should return false once the call is started": function(test) {
this.wrappedFn.yields(new Error()).yields(null, 'Success!');
this.wrappedFn.
onFirstCall().yields(new Error()).
onSecondCall().yields(null, 'Success!');
var call = new FunctionCall(this.wrappedFn, [], this.callback);

test.ok(call.isPending());
Expand All @@ -63,7 +65,9 @@ exports["FunctionCall"] = {
},

"isRunning should return true when call is in progress": function(test) {
this.wrappedFn.yields(new Error()).yields(null, 'Success!');
this.wrappedFn.
onFirstCall().yields(new Error()).
onSecondCall().yields(null, 'Success!');
var call = new FunctionCall(this.wrappedFn, [], this.callback);

test.ok(!call.isRunning());
Expand All @@ -78,7 +82,9 @@ exports["FunctionCall"] = {
},

"isCompleted should return true once the call completes": function(test) {
this.wrappedFn.yields(new Error()).yields(null, 'Success!');
this.wrappedFn.
onFirstCall().yields(new Error()).
onSecondCall().yields(null, 'Success!');
var call = new FunctionCall(this.wrappedFn, [], this.callback);

test.ok(!call.isCompleted());
Expand All @@ -93,7 +99,9 @@ exports["FunctionCall"] = {
},

"isAborted should return true once the call is aborted": function(test) {
this.wrappedFn.yields(new Error()).yields(null, 'Success!');
this.wrappedFn.
onFirstCall().yields(new Error()).
onSecondCall().yields(null, 'Success!');
var call = new FunctionCall(this.wrappedFn, [], this.callback);

test.ok(!call.isAborted());
Expand Down Expand Up @@ -181,10 +189,11 @@ exports["FunctionCall"] = {

"call should complete when the wrapped function succeeds": function(test) {
var call = new FunctionCall(this.wrappedFn, [1, 2, 3], this.callback);
this.wrappedFn.yields(new Error())
.yields(new Error())
.yields(new Error())
.yields(null, 'Success!');
this.wrappedFn.
onCall(0).yields(new Error()).
onCall(1).yields(new Error()).
onCall(2).yields(new Error()).
onCall(3).yields(null, 'Success!');

call.start(this.backoffFactory);

Expand Down

0 comments on commit 2e0d6c7

Please sign in to comment.