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
# 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
…ly converted to AnyCodable
…le protocol conformance
10 tasks
# Conflicts: # Sources/XCTestCase+AnyCodableAsserts.swift # Tests/UnitTests/AnyCodablePathOptionsTests.swift
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.
Note
This PR should be merged after: #15
This PR introduces the concept of the
AnyCodableComparableprotocol, which allows the JSON comparison methods to automatically convert common Swift and Experience Platform SDK representations of JSON data into AnyCodable format.The base protocol requires a simple conversion method:
Conforming types simply implement whatever conversion to AnyCodable makes the most sense for the given type:
The list of conforming types in this PR:
OptionalDictionaryStringAnyCodable(AEP)Event(AEP)NetworkRequest(AEP)The JSON comparison methods accept all types conforming to the new
AnyCodableComparableprotocol and handle the conversion to AnyCodable. This means that:AnyCodablebefore calling the comparison method itself (given the input type conforms to AnyCodableComparable)i. The getAnyCodable methods are now redundant and removed
Note that assertEqual does allow for a
nilexpectedvalue, howeverassertTypeMatchandassertExactMatchdo not allow expected to benil- users should instead useXCTAssertNil. This is to:nilvalues due to conversion failuresnilvalues more explicitNote the reduction of boilerplate:
BEFORE
AFTER
Related Issue
Motivation and Context
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Checklist: