Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

have.deep.property does not work #5

Closed
realyze opened this issue May 22, 2012 · 3 comments
Closed

have.deep.property does not work #5

realyze opened this issue May 22, 2012 · 3 comments

Comments

@realyze
Copy link

realyze commented May 22, 2012

The following code snippet fails when run in Mocha:

chai = require 'chai'
cap = require 'chai-as-promised'
chai.use cap
P = require 'node-promise'
expect = require('chai').expect

it "should succeed but it fails", (done)->
  foo = ->
    def = P.defer()
    def.resolve a:b:2
    return def.promise
  expect(foo()).to.eventually.have.deep.property('a.b').notify(done)

I am getting "expected { a: { b: 2 } } to have a property 'a.b'". When I try

expect(a:b:2).to.have.deep.property("a.b")

it works fine.
Q promises (Kriskowal) fail as well.

@domenic
Copy link
Collaborator

domenic commented May 22, 2012

Nice catch, thank you. The problem is that I don't transfer the deep flag.

Currently I transfer the negate flag manually, but this seems icky and not very future-proof. I've asked @logicalparadox about adding some utils to Chai to facilitate the process of transferring flags. Once that gets in I can make this fix.

In the meantime I'll write some failing tests.

domenic added a commit that referenced this issue May 22, 2012
Related to GH-5. These will require some Chai support in order to get a
good fix in.
domenic added a commit to chaijs/chai that referenced this issue May 27, 2012
@domenic
Copy link
Collaborator

domenic commented May 27, 2012

This is fixed, but the test suite does not pass yet due to a bug in Chai 1.0.2 (fixed in chaijs/chai@db98bd6), so I will not release a new version to npm quite yet. But, Chai 1.0.3 should be out very shortly, and with it, Chai as Promised 3.2.0.

@realyze
Copy link
Author

realyze commented May 28, 2012

Nice, thanks for such a quick reaction, @domenic !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants