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

feat(object-assertion): Matchers use variadic arguments #89

Merged
merged 1 commit into from
Jul 20, 2023

Conversation

JoseLion
Copy link
Member

This PR updates most of the ObjectAssertion matches to use variadic parameters. It also updates the AssertionError options so we can show diffs when the assertion fails, providing more complete information to the user.

@JoseLion JoseLion requested a review from byrpatrick July 18, 2023 15:52
@JoseLion JoseLion self-assigned this Jul 18, 2023
@JoseLion JoseLion force-pushed the feat/variadic-params-object-assertion branch 2 times, most recently from b88e7db to c5b9029 Compare July 18, 2023 15:54
Copy link
Member

@byrpatrick byrpatrick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! I like how it displays the diff when the assertion fails.

Also, thanks @JoseLion for pointing that out 😅 I forgot to include the expected property during the first iteration. It is missing the expected property on the following methods too:

  • toBeEmpty
  • toContainKey
  • toContainValue
  • toContainEntry

Do you mind if I commit a fix for this on this branch?

@JoseLion
Copy link
Member Author

As we discussed internally, it'd be ok to add the expected value to toBeEmpty. The other methods would generate a diff that could be misleading of the real error. Good catch @byrpatrick!

BREAKING CHANGE: Some ObjectAssertion matchers should use variadic arguments instead of arrays array
@JoseLion JoseLion force-pushed the feat/variadic-params-object-assertion branch from c5b9029 to a513ae6 Compare July 20, 2023 16:31
@JoseLion JoseLion merged commit 9a019ff into main Jul 20, 2023
@JoseLion JoseLion deleted the feat/variadic-params-object-assertion branch July 20, 2023 16:42
@JoseLion
Copy link
Member Author

@all-contributors please add @byrpatrick for review

@allcontributors
Copy link
Contributor

@JoseLion

I've put up a pull request to add @byrpatrick! 🎉

@github-actions
Copy link

🎉 This PR is included in version 1.3.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Copy link

🎉 This PR is included in version 1.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

2 participants