Testing value of nested property in chai-as-promised and mocha
<p>I'm trying to test a function that returns a promise using the <em>chai-as-promised</em> library. The result in my promise is an object with nested properties. Is it possible to test a deeply nested property's value.</p>

<p>E.g.</p>

<pre><code>function myFunc() {
  return new Promise((resolve, reject) =&gt; {
    const data = {
      thing: {
        foo: 'bar',
        baz: 'lah'
      }
    }
    resolve(data)
  })
}
</code></pre>

<p>How can I test that the <code>foo</code> property equals "bar" without checking the entire object? I've tried something like this:</p>

<pre><code>expect(myFunc()).to.eventually.have.property('thing.foo', 'bar')
</code></pre>

<p>But no luck!</p>