Skip to content

Fixed iOS 12 Codable tests#1606

Merged
NachoSoto merged 1 commit into
mainfrom
fix-all-ios-12-tests
May 24, 2022
Merged

Fixed iOS 12 Codable tests#1606
NachoSoto merged 1 commit into
mainfrom
fix-all-ios-12-tests

Conversation

@NachoSoto

Copy link
Copy Markdown
Contributor

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.

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 NachoSoto requested a review from a team May 24, 2022 18:26
@NachoSoto NachoSoto merged commit 9b82e63 into main May 24, 2022
@NachoSoto NachoSoto deleted the fix-all-ios-12-tests branch May 24, 2022 21:13
@joshdholtz joshdholtz mentioned this pull request May 26, 2022
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