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

Adds sinon.match.hasNested #1560

Merged
merged 2 commits into from
Sep 18, 2017
Merged

Adds sinon.match.hasNested #1560

merged 2 commits into from
Sep 18, 2017

Conversation

servel333
Copy link
Contributor

Purpose (TL;DR) - mandatory

PR for #1556, adds sinon.match.hasNested so sinon.match.has chains can be avoided.

sinon.match.has('outer', sinon.match.has('middle', sinon.match.has('inner', sinon.match.string)));
sinon.match.hasNested('outer.middle.inner', sinon.match.string);

Nested array's are supported too.

sinon.match.hasNested('outer[0].inner', sinon.match.string);
  • Adds dependency lodash.get@^4.4.2.
  • Adds tests for hasNested
  • Adds documentation for hasNested

Solution - optional

I was unable to use the existing createPropertyMatcher in the marcher code because it expects the property to not be nested when comparing the expectation.

How to verify - mandatory

  1. Check out this branch
  2. npm install
  3. npm test

Checklist for author

  • npm run lint passes
  • References to standard library functions are cached.
    • What?

@fatso83
Copy link
Contributor

fatso83 commented Sep 18, 2017

Thank you for this! As to what caching standard library functions means, see the link to #1523 for an elaboration 😄

@fatso83 fatso83 merged commit 10906a7 into sinonjs:master Sep 18, 2017
@fatso83
Copy link
Contributor

fatso83 commented Sep 18, 2017

Released as Sinon 3.3.0

@servel333
Copy link
Contributor Author

Thank you for this! As to what caching standard library functions means, see the link to #1523 for an elaboration

I see the link in my own PR description now... I can't believe I missed that.

@servel333 servel333 deleted the nested_property_matcher branch May 29, 2018 18:49
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

Successfully merging this pull request may close these issues.

2 participants