Automattic / Automattic/expect.js
"Sub" object checking?
- Dominant language
- JavaScript
- Stars
- 2.1k
- Forks
- 207
- PR merge metrics
- No merged PRs in 30d
Description
Hey there,
Great work on the library -- I really like it.
In writing tests against a REST API, I'd find it really convenient to check that response objects, which can have many properties and values, contain _some_ particular properties and values.
@visionmedia's should.js has `include()` for this kind of thing, and it's really helpful:
https://github.com/visionmedia/should.js#includeobj
Here it might be e.g.:
``` js
expect(resp).to.include({
name: 'John Smith',
username: 'johnsmith',
age: 29
});
```
But whereas should's `include()` is for checking presence in arrays and strings too, I see that expect has `contain()` for those. So maybe this could be added into `contain()`, but maybe not.
What do you think? Thanks!
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.