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

Add 'does not include' assertion operator #29

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

pota92
Copy link

@pota92 pota92 commented Nov 16, 2021

The negative version of include operator seems to be missing, this PR tries to add it

  • Moved the findOffendingItem fn to utils so it can be reused in both Operations.
  • subError describes at which property the recursiveMatch failed. But for does not include failures, I just used errorPath.
    When does not include fails, errorPath indicates at which index the occurrence was indeed found (took the same approach as is not operator)

@joac
Copy link
Contributor

joac commented Dec 6, 2021

@pzavolinsky can you take a look? I'm not very experienced with that part of the code base to review.

Scenario: {} does not include { "a": null }
Given A is {}
When asserting that A does not include { "a": null}
Then the assertion fails with {} does include {"a":null}
Copy link
Member

Choose a reason for hiding this comment

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

this doesn't look right, A does not have a null valued a property so the assertion should pass.

@@ -0,0 +1,58 @@
Feature: compare JSON does not include X
Copy link
Member

Choose a reason for hiding this comment

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

you should add compound operand tests for does not include, stuff like:

{ "a": 1 } does not include { "a": 1, "b": 2 }

☝️ also what would be the right outcome of this? { "a": 1 } certainly doesn't include the full { "a": 1, "b": 2 } but it does include a part of it.

maybe we also need a does not overlap operator that distinguishes between inclusion and intersection.

@pota92 pota92 marked this pull request as draft March 9, 2022 00:04
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.

3 participants