Skip to content

feat: explicit messages when JSON node (does not) contain text - #44

Merged
Jean-Beru merged 2 commits into
soyuka:mainfrom
Jean-Beru:contain-better-message
Oct 16, 2026
Merged

Jean-Beru merged 2 commits into
soyuka:mainfrom
Jean-Beru:contain-better-message

Conversation

@Jean-Beru

Copy link
Copy Markdown
Collaborator

Replaces #33 by @jdeniau. It keeps the original commit and applies the review.

Why

When the JSON node :node should contain :text fails, the message does not show the node or its value. This makes the failure hard to debug. The should not contain step has the same problem.

What

  • theJsonNodeShouldContain and theJsonNodeShouldNotContain show the node, the expected text and the full node value.
  • The value is not truncated.
  • Unit tests cover both steps, with the single and the table variants.

Example

  And the JSON node "hydra:description" should contain "coucou"
-   The string 'coucou' was not found.
+   The node 'hydra:description' should contain 'coucou', but it is 'This value should be equal to 1.'.

  And the JSON node "hydra:description" should not contain "ipsum"
-   The string 'ipsum' was found.
+   The node 'hydra:description' should not contain 'ipsum', but it is 'Lorem ipsum'.

@Jean-Beru
Jean-Beru merged commit 5d8ef05 into soyuka:main Oct 16, 2026
23 checks passed
@Jean-Beru

Copy link
Copy Markdown
Collaborator Author

Thanks @jdeniau !

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