Merged
Conversation
Refactor AnyCodable assert methods to use new NodeConfig class
…by the new node system
Update method docs Rename helper method to more generic validateJSON
10 tasks
cdhoffmann
requested changes
Dec 13, 2023
| assertExactMatch(expected: expected, actual: actual, pathOptions: KeyMustBeAbsent(paths: "key1")) | ||
| } | ||
| } | ||
| } |
Contributor
There was a problem hiding this comment.
Can we add a few more tests which show the power of the customizable nature of the paths? Something with more complex paths would be great.
Contributor
Author
There was a problem hiding this comment.
This is a great suggestion! I've added a bunch of new tests covering general path options and the new KeyMustBeAbsent option in the new file: AnyCodablePathOptionsTests.swift
# Conflicts: # Sources/NodeConfig.swift # Sources/XCTestCase+AnyCodableAsserts.swift
Add additional docs for test case
…nstead of single Bool Refactor JSON validation to traverse actual for negative validation cases like key must be absent Refactor assertExactMatch and assertTypeMatch to funnel into same validation method since only initial subtree state is different Add tests for path options
This was referenced Dec 15, 2023
Closed
Merged
cdhoffmann
approved these changes
Dec 15, 2023
10 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This new JSON comparison option allows test writers to specify key paths whose key names should not be present. It also demonstrates the relative ease of adding new comparison options using the new
NodeConfigarchitecture introduced in #9.At a high level it contains:
KeyMustBeAbsentwhich conforms toMultiPathConfigExample:
KeyMustBeAbsentvalidateActual) which recursively traverses theactualJSON structure to support cases likeKeyMustBeAbsentassertExactMatchandassertTypeMatchto funnel into the same validation method since their only difference is subtree validation defaultsQuestions for reviewers
keyNamesargs when using the variadic param format for theKeyMustBeAbsentpath option?keyNamesis missed initially, it must be fixed before committing.aepsdk-testutils-ios/Tests/UnitTests/AnyCodablePathOptionsTests.swift
Lines 685 to 699 in 70502cd
Related Issue
Motivation and Context
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Checklist: