Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests: added iOS 17 snapshots #2603

Merged
merged 1 commit into from
Jun 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion Tests/UnitTests/Misc/AnyEncodableTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,12 @@ class AnyEncodableTests: TestCase {
"d": nil
]

assertSnapshot(matching: AnyEncodable(dictionary), as: .json)
assertSnapshot(
matching: AnyEncodable(dictionary),
as: .json,
// Formatting `Double`s changed in iOS 17
testName: CurrentTestCaseTracker.osVersionAndTestName
)
}

func testEncodingInvalidDataFails() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"a" : 1,
"b" : {
"b1" : false,
"b2" : {
"b21" : 1,
"b22" : "https:\/\/google.com"
},
"b3" : [
20.199999999999999,
19.989999999999998,
5
],
"b4" : 50000
},
"c" : "3",
"d" : null
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"a" : 1,
"b" : {
"b1" : false,
"b2" : {
"b21" : 1,
"b22" : "https:\/\/google.com"
},
"b3" : [
20.199999999999999,
19.989999999999998,
5
],
"b4" : 50000
},
"c" : "3",
"d" : null
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"a" : 1,
"b" : {
"b1" : false,
"b2" : {
"b21" : 1,
"b22" : "https:\/\/google.com"
},
"b3" : [
20.199999999999999,
19.989999999999998,
5
],
"b4" : 50000
},
"c" : "3",
"d" : null
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"a" : 1,
"b" : {
"b1" : false,
"b2" : {
"b21" : 1,
"b22" : "https:\/\/google.com"
},
"b3" : [
20.199999999999999,
19.989999999999998,
5
],
"b4" : 50000
},
"c" : "3",
"d" : null
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"a" : 1,
"b" : {
"b1" : false,
"b2" : {
"b21" : 1,
"b22" : "https:\/\/google.com"
},
"b3" : [
20.2,
19.99,
Comment on lines +10 to +11
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This no longer prints the imprecise decimals.

5
],
"b4" : 50000
},
"c" : "3",
"d" : null
}
5 changes: 1 addition & 4 deletions Tests/UnitTests/Mocks/MockHTTPClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,10 @@ class MockHTTPClient: HTTPClient {
DispatchQueue.main.async {
self.calls.append(call)

let osVersionEquivalent = OSVersionEquivalent.current
let testName = "iOS\(osVersionEquivalent.rawValue)/\(CurrentTestCaseTracker.sanitizedTestName)"

assertSnapshot(matching: call,
as: .formattedJson,
file: self.sourceTestFile,
testName: testName)
testName: CurrentTestCaseTracker.osVersionAndTestName)

let mock = self.mocks[request.path] ?? .init(statusCode: .success)

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"headers" : {
"Authorization" : "Bearer asharedsecret"
},
"request" : {
"body" : null,
"method" : "GET",
"url" : "https://api.revenuecat.com/v1/subscribers/user"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"headers" : {
"Authorization" : "Bearer asharedsecret"
},
"request" : {
"body" : null,
"method" : "GET",
"url" : "https://api.revenuecat.com/v1/subscribers/user"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"headers" : {
"Authorization" : "Bearer asharedsecret"
},
"request" : {
"body" : null,
"method" : "GET",
"url" : "https://api.revenuecat.com/v1/subscribers/user_id_2"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"headers" : {
"Authorization" : "Bearer asharedsecret"
},
"request" : {
"body" : null,
"method" : "GET",
"url" : "https://api.revenuecat.com/v1/subscribers/userid%20with%20spaces"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"headers" : {
"Authorization" : "Bearer asharedsecret"
},
"request" : {
"body" : null,
"method" : "GET",
"url" : "https://api.revenuecat.com/v1/subscribers/user"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"headers" : {
"Authorization" : "Bearer asharedsecret"
},
"request" : {
"body" : null,
"method" : "GET",
"url" : "https://api.revenuecat.com/v1/subscribers/user"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"headers" : {
"Authorization" : "Bearer asharedsecret"
},
"request" : {
"body" : null,
"method" : "GET",
"url" : "https://api.revenuecat.com/v1/subscribers/user"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"headers" : {
"Authorization" : "Bearer asharedsecret"
},
"request" : {
"body" : null,
"method" : "GET",
"url" : "https://api.revenuecat.com/v1/subscribers/user"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"headers" : {
"Authorization" : "Bearer asharedsecret"
},
"request" : {
"body" : null,
"method" : "GET",
"url" : "https://api.revenuecat.com/v1/subscribers/user"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"headers" : {
"Authorization" : "Bearer asharedsecret"
},
"request" : {
"body" : null,
"method" : "GET",
"url" : "https://api.revenuecat.com/v1/subscribers/user"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"headers" : {
"Authorization" : "Bearer asharedsecret"
},
"request" : {
"body" : null,
"method" : "GET",
"url" : "https://api.revenuecat.com/v1/subscribers/user"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"headers" : {
"Authorization" : "Bearer asharedsecret",
"X-Nonce" : "MTIzNDU2Nzg5MGFi"
},
"request" : {
"body" : null,
"method" : "GET",
"url" : "https://api.revenuecat.com/v1/subscribers/user"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"headers" : {
"Authorization" : "Bearer asharedsecret"
},
"request" : {
"body" : null,
"method" : "GET",
"url" : "https://api.revenuecat.com/v1/subscribers/user"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"headers" : {
"Authorization" : "Bearer asharedsecret"
},
"request" : {
"body" : {
"fetch_token" : "AQI=",
"product_identifiers" : [
"producta",
"productb",
"productc"
]
},
"method" : "POST",
"url" : "https://api.revenuecat.com/v1/subscribers/user/intro_eligibility"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"headers" : {
"Authorization" : "Bearer asharedsecret"
},
"request" : {
"body" : {
"fetch_token" : "AQI=",
"product_identifiers" : [
"producta",
"productb",
"productc"
]
},
"method" : "POST",
"url" : "https://api.revenuecat.com/v1/subscribers/user/intro_eligibility"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"headers" : {
"Authorization" : "Bearer asharedsecret"
},
"request" : {
"body" : {
"fetch_token" : "AQID",
"product_identifiers" : [
"producta",
"productb",
"productc",
"productd"
]
},
"method" : "POST",
"url" : "https://api.revenuecat.com/v1/subscribers/user/intro_eligibility"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"headers" : {
"Authorization" : "Bearer asharedsecret"
},
"request" : {
"body" : null,
"method" : "GET",
"url" : "https://api.revenuecat.com/v1/subscribers/user/offerings"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"headers" : {
"Authorization" : "Bearer asharedsecret"
},
"request" : {
"body" : null,
"method" : "GET",
"url" : "https://api.revenuecat.com/v1/subscribers/user_id_2/offerings"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"headers" : {
"Authorization" : "Bearer asharedsecret"
},
"request" : {
"body" : null,
"method" : "GET",
"url" : "https://api.revenuecat.com/v1/subscribers/user/offerings"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"headers" : {
"Authorization" : "Bearer asharedsecret"
},
"request" : {
"body" : null,
"method" : "GET",
"url" : "https://api.revenuecat.com/v1/subscribers/user/offerings"
}
}
Loading