Option to ignore unspecified keys when using shouldEqualJson matcher #2298
Labels
assertions 🔍
Related to the assertion mechanisms within the testing framework.
enhancement ✨
Suggestions for adding new features or improving existing ones.
good-first-issue 👶
Suitable for newcomers looking to contribute to the project.
pinned 📌
Issues of high importance or that need to remain visible.
Milestone
I'd like an option for
shouldEqualJson
to ignore keys in actual that are unspecified in expected. It should probably be included forshouldNotEqualJson
as well.I think this could be achieved either by:
CompareMode
with new modes:CompareMode.StrictIgnoringUnknownKeys
andCompareMode.LenientIgnoringUnknownKeys
ignoreUnknownKeys: Boolean
shouldEqualSpecifiedJson
? Better names? 😅Following example should pass:
The text was updated successfully, but these errors were encountered: