Skip to content

Commit

Permalink
Fix for varying brace spacing in different Sinon versions
Browse files Browse the repository at this point in the history
  • Loading branch information
cincodenada committed Nov 1, 2021
1 parent d086d58 commit 2e24e7f
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions test/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,10 @@ describe("Messages", function () {

spy.call(badContext);

var expected = "expected spy to have been called with { } as this, but it was called with " +
spy.printf("%t") + " instead";
var expected = new RegExp(
"expected spy to have been called with \\{\\s*\\} as this, but it was called with " +
spy.printf("%t") + " instead"
);
expect(function () {
spy.should.have.been.calledOn(context);
}).to.throw(expected);
Expand All @@ -177,7 +179,7 @@ describe("Messages", function () {

spy.call(context);

var expected = "expected spy to not have been called with { } as this";
var expected = /expected spy to not have been called with \{\s*\} as this/;
expect(function () {
spy.should.not.have.been.calledOn(context);
}).to.throw(expected);
Expand All @@ -193,8 +195,10 @@ describe("Messages", function () {

spy.call(badContext);

var expected = "expected spy to always have been called with { } as this, but it was called with " +
spy.printf("%t") + " instead";
var expected = new RegExp(
"expected spy to always have been called with \\{\\s*\\} as this, but it was called with " +
spy.printf("%t") + " instead"
);
expect(function () {
spy.should.always.have.been.calledOn(context);
}).to.throw(expected);
Expand Down

0 comments on commit 2e24e7f

Please sign in to comment.