Skip to content

Commit

Permalink
Harmonize error messages with those of Chai
Browse files Browse the repository at this point in the history
  • Loading branch information
lddubeau authored and domenic committed Sep 27, 2016
1 parent a8b88d0 commit 10beb9e
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 27 deletions.
12 changes: 6 additions & 6 deletions test/assert-promise-specific.coffee
Expand Up @@ -159,30 +159,30 @@ describe "Assert interface:", =>
describe ".isRejected(promise, RangeError, 'quux')", =>
shouldFail
op: => assert.isRejected(promise, RangeError, "quux")
message: "to be rejected with an error including 'quux' but got 'RangeError: foo bar'"
message: "to be rejected with an error including 'quux' but got 'foo bar'"

describe ".isRejected(promise, RangeError, /quux/)", =>
shouldFail
op: => assert.isRejected(promise, RangeError, /quux/)
message: "to be rejected with an error matching /quux/ but got 'RangeError: foo bar'"
message: "to be rejected with an error matching /quux/ but got 'foo bar'"

describe ".isRejected(promise, TypeError, 'foo')", =>
shouldFail
op: => assert.isRejected(promise, TypeError, 'foo')
message: "to be rejected with 'TypeError' but it was rejected with [RangeError: foo bar]"
message: "to be rejected with 'TypeError' but it was rejected with 'RangeError: foo bar'"
describe ".isRejected(promise, TypeError, /bar/)", =>
shouldFail
op: => assert.isRejected(promise, TypeError, /bar/)
message: "to be rejected with 'TypeError' but it was rejected with [RangeError: foo bar]"
message: "to be rejected with 'TypeError' but it was rejected with 'RangeError: foo bar'"

describe ".isRejected(promise, TypeError, 'quux')", =>
shouldFail
op: => assert.isRejected(promise, TypeError, 'quux')
message: "to be rejected with 'TypeError' but it was rejected with [RangeError: foo bar]"
message: "to be rejected with 'TypeError' but it was rejected with 'RangeError: foo bar'"
describe ".isRejected(promise, TypeError, /quux/)", =>
shouldFail
op: => assert.isRejected(promise, TypeError, /quux/)
message: "to be rejected with 'TypeError' but it was rejected with [RangeError: foo bar]"
message: "to be rejected with 'TypeError' but it was rejected with 'RangeError: foo bar'"

describe ".isRejected(promise, RangeError, 'foo', custom)", =>
shouldPass => assert.isRejected(promise, RangeError, "foo", custom)
Expand Down
42 changes: 21 additions & 21 deletions test/should-promise-specific.coffee
Expand Up @@ -80,7 +80,7 @@ describe "Promise-specific extensions:", =>
describe ".rejectedWith(errorInstance)", =>
shouldFail
op: => promise.should.be.rejectedWith(error)
message: "to be rejected with [Error: boo] but it was fulfilled with 42"
message: "to be rejected with 'Error: boo' but it was fulfilled with 42"

describe ".not.rejected", =>
shouldPass => promise.should.not.be.rejected
Expand Down Expand Up @@ -109,7 +109,7 @@ describe "Promise-specific extensions:", =>
describe ".fulfilled", =>
shouldFail
op: => promise.should.be.fulfilled
message: "to be fulfilled but it was rejected with [Error: boo]"
message: "to be fulfilled but it was rejected with 'Error: boo'"

describe ".not.fulfilled", =>
shouldPass => promise.should.not.be.fulfilled
Expand All @@ -127,7 +127,7 @@ describe "Promise-specific extensions:", =>
describe ".not.rejected", =>
shouldFail
op: => promise.should.not.be.rejected
message: "not to be rejected but it was rejected with [Error: boo]"
message: "not to be rejected but it was rejected with 'Error: boo'"
describe ".rejected should allow chaining", =>
shouldPass => promise.should.be.rejected.and.eventually.have.property("myProp")

Expand All @@ -141,7 +141,7 @@ describe "Promise-specific extensions:", =>
describe ".not.rejectedWith(theError)", =>
shouldFail
op: => promise.should.not.be.rejectedWith(error)
message: "not to be rejected with [Error: boo]"
message: "not to be rejected with 'Error: boo'"

describe ".rejectedWith(theError) should allow chaining", =>
shouldPass => promise.should.be.rejectedWith(error).and.eventually.have.property("myProp")
Expand All @@ -153,7 +153,7 @@ describe "Promise-specific extensions:", =>
describe ".rejectedWith(differentError)", =>
shouldFail
op: => promise.should.be.rejectedWith(new Error)
message: "to be rejected with [Error] but it was rejected with [Error: boo]"
message: "to be rejected with 'Error' but it was rejected with 'Error: boo'"

describe ".not.rejectedWith(differentError)", =>
shouldPass => promise.should.not.be.rejectedWith(new Error)
Expand All @@ -164,7 +164,7 @@ describe "Promise-specific extensions:", =>
describe ".rejectedWith(differentError, custom)", =>
shouldFail
op: => promise.should.be.rejectedWith(new Error, custom)
message: "to be rejected with [Error] but it was rejected with [Error: boo]"
message: "to be rejected with 'Error' but it was rejected with 'Error: boo'"
notMessage: custom

describe ".not.rejectedWith(differentError, custom)", =>
Expand Down Expand Up @@ -194,15 +194,15 @@ describe "Promise-specific extensions:", =>
describe ".rejectedWith('quux')", =>
shouldFail
op: => promise.should.be.rejectedWith("quux")
message: "to be rejected with an error including 'quux' but got 'Error: foo bar'"
message: "to be rejected with an error including 'quux' but got 'foo bar'"

describe ".not.rejectedWith('quux')", =>
shouldPass => promise.should.be.not.rejectedWith("quux")

describe ".rejectedWith(/quux/)", =>
shouldFail
op: => promise.should.be.rejectedWith(/quux/)
message: "to be rejected with an error matching /quux/ but got 'Error: foo bar'"
message: "to be rejected with an error matching /quux/ but got 'foo bar'"

describe ".not.rejectedWith(/quux/)", =>
shouldPass => promise.should.not.be.rejectedWith(/quux/)
Expand Down Expand Up @@ -239,18 +239,18 @@ describe "Promise-specific extensions:", =>
describe ".not.rejectedWith(RangeError)", =>
shouldFail
op: => promise.should.not.be.rejectedWith(RangeError)
message: "not to be rejected with 'RangeError' but it was rejected with [RangeError]"
message: "not to be rejected with 'RangeError' but it was rejected with 'RangeError'"

describe ".rejectedWith(TypeError)", =>
shouldFail
op: => promise.should.be.rejectedWith(TypeError)
message: "to be rejected with 'TypeError' but it was rejected with [RangeError]"
message: "to be rejected with 'TypeError' but it was rejected with 'RangeError'"

# Case for issue #64.
describe ".rejectedWith(Array)", =>
shouldFail
op: => promise.should.be.rejectedWith(Array)
message: "to be rejected with 'Array' but it was rejected with [RangeError]"
message: "to be rejected with 'Array' but it was rejected with 'RangeError'"

describe ".not.rejectedWith(TypeError)", =>
shouldPass => promise.should.not.be.rejectedWith(TypeError)
Expand All @@ -266,51 +266,51 @@ describe "Promise-specific extensions:", =>
describe ".not.rejectedWith(RangeError, 'foo')", =>
shouldFail
op: => promise.should.not.be.rejectedWith(RangeError, "foo")
message: "not to be rejected with 'RangeError' but it was rejected with [RangeError: foo bar]"
message: "not to be rejected with 'RangeError' but it was rejected with 'RangeError: foo bar'"

describe ".rejectedWith(RangeError, /bar/)", =>
shouldPass => promise.should.be.rejectedWith(RangeError, /bar/)

describe ".not.rejectedWith(RangeError, /bar/)", =>
shouldFail
op: => promise.should.not.be.rejectedWith(RangeError, /bar/)
message: "not to be rejected with 'RangeError' but it was rejected with [RangeError: foo bar]"
message: "not to be rejected with 'RangeError' but it was rejected with 'RangeError: foo bar'"

describe ".rejectedWith(RangeError, 'quux')", =>
shouldFail
op: => promise.should.be.rejectedWith(RangeError, "quux")
message: "to be rejected with an error including 'quux' but got 'RangeError: foo bar'"
message: "to be rejected with an error including 'quux' but got 'foo bar'"
describe ".rejectedWith(RangeError, /quux/)", =>
shouldFail
op: => promise.should.be.rejectedWith(RangeError, /quux/)
message: "to be rejected with an error matching /quux/ but got 'RangeError: foo bar'"
message: "to be rejected with an error matching /quux/ but got 'foo bar'"

describe ".rejectedWith(TypeError, 'foo')", =>
shouldFail
op: => promise.should.be.rejectedWith(TypeError, 'foo')
message: "to be rejected with 'TypeError' but it was rejected with [RangeError: foo bar]"
message: "to be rejected with 'TypeError' but it was rejected with 'RangeError: foo bar'"
describe ".rejectedWith(TypeError, /bar/)", =>
shouldFail
op: => promise.should.be.rejectedWith(TypeError, /bar/)
message: "to be rejected with 'TypeError' but it was rejected with [RangeError: foo bar]"
message: "to be rejected with 'TypeError' but it was rejected with 'RangeError: foo bar'"

describe ".rejectedWith(TypeError, 'quux')", =>
shouldFail
op: => promise.should.be.rejectedWith(TypeError, 'quux')
message: "to be rejected with 'TypeError' but it was rejected with [RangeError: foo bar]"
message: "to be rejected with 'TypeError' but it was rejected with 'RangeError: foo bar'"
describe ".rejectedWith(TypeError, /quux/)", =>
shouldFail
op: => promise.should.be.rejectedWith(TypeError, /quux/)
message: "to be rejected with 'TypeError' but it was rejected with [RangeError: foo bar]"
message: "to be rejected with 'TypeError' but it was rejected with 'RangeError: foo bar'"

describe ".not.rejectedWith(RangeError, 'foo')", =>
shouldFail
op: => promise.should.not.be.rejectedWith(RangeError, 'foo')
message: "not to be rejected with 'RangeError' but it was rejected with [RangeError: foo bar]"
message: "not to be rejected with 'RangeError' but it was rejected with 'RangeError: foo bar'"
describe ".not.rejectedWith(RangeError, /bar/)", =>
shouldFail
op: => promise.should.not.be.rejectedWith(RangeError, /bar/)
message: "not to be rejected with 'RangeError' but it was rejected with [RangeError: foo bar]"
message: "not to be rejected with 'RangeError' but it was rejected with 'RangeError: foo bar'"

describe ".not.rejectedWith(RangeError, 'quux')", =>
shouldPass => promise.should.not.be.rejectedWith(RangeError, 'quux')
Expand Down

0 comments on commit 10beb9e

Please sign in to comment.