I'm using Coffeescript, Mocha, and chai, and I have the following code:
class Herp extends Error
message = "derpy!"
class Foo
@bar: ->
new Promise(() =>
throw Herp(message)
)
describe 'Berp', ->
it 'should herp a derp', ->
Foo.bar().should.eventually.be.rejectedWith(Herp(message))
I do not understand why, when I run this test, it tells me:
AssertionError: expected promise to be rejected with [Error: derpy!] but it was rejected with [Error: derpy!]
Cause that message looks an awful lot like it's saying that it expected it to be rejected with the exact thing it was rejected with. What am I doing wrong here?
❯ grep chai package.json
"chai": "^3.5.0",
"chai-as-promised": "^5.3.0",
❯ node --version
v6.4.0
❯ npm --version
3.10.3
Aucun commentaire:
Enregistrer un commentaire