Added tests for PeriodType/PurchaseOwnershipType/Store#1558
Merged
Conversation
859b659 to
1e14a85
Compare
Follow up to #1551. Using `Codable.encodeAndDecode` we ensure that each value can be bidirectionally converted. These tests exposed that unknown values were being encoded as `null`, but then failed to decode. I've updated the implementation and added a few more tests to cover this behavior.
1e14a85 to
65db99a
Compare
aboedo
approved these changes
May 19, 2022
NachoSoto
added a commit
that referenced
this pull request
May 24, 2022
Follow up to #1589. Fixes https://app.circleci.com/pipelines/github/RevenueCat/purchases-ios/6805/workflows/550827f9-ff8e-469d-b7a7-889417582eff/jobs/26743 Turns out the tests introduced in #1558 weren't compatible with iOS 12. As explained in #1589. For some reason, on iOS 12.x only, this: ``` JSONDecoder.default.decode(jsonData: "null".data(using: .utf8)!) ``` Fails: > dataCorrupted(Swift.DecodingError.Context(codingPath: [], debugDescription: "The given data was not valid JSON.", underlyingError: Optional(Error Domain=NSCocoaErrorDomain Code=3840 "JSON text did not start with array or object and option to allow fragments not set." UserInfo={NSDebugDescription=JSON text did not start with array or object and option to allow fragments not set.}))) Since iOS 12.x doesn't allow decoding top-level objects, I've simply disabled these tests. Decoding this types is already tested as part of other types. These new types only added more explicit testing.
NachoSoto
added a commit
that referenced
this pull request
May 24, 2022
Follow up to #1589. Fixes https://app.circleci.com/pipelines/github/RevenueCat/purchases-ios/6805/workflows/550827f9-ff8e-469d-b7a7-889417582eff/jobs/26743 Turns out the tests introduced in #1558 weren't compatible with iOS 12. As explained in #1589. For some reason, on iOS 12.x only, this: ``` JSONDecoder.default.decode(jsonData: "null".data(using: .utf8)!) ``` Fails: > dataCorrupted(Swift.DecodingError.Context(codingPath: [], debugDescription: "The given data was not valid JSON.", underlyingError: Optional(Error Domain=NSCocoaErrorDomain Code=3840 "JSON text did not start with array or object and option to allow fragments not set." UserInfo={NSDebugDescription=JSON text did not start with array or object and option to allow fragments not set.}))) Since iOS 12.x doesn't allow decoding top-level objects, I've simply disabled these tests. Decoding this types is already tested as part of other types. These new types only added more explicit testing.
Merged
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.
Follow up to #1551. Using
Codable.encodeAndDecodewe ensure that each value can be bidirectionally converted.These tests exposed that unknown values were being encoded as
null, but then failed to decode.I've updated the implementation and added a few more tests to cover this behavior.