Skip to content

Commit

Permalink
Fix test check for locale
Browse files Browse the repository at this point in the history
  • Loading branch information
vegaro committed Jul 9, 2024
1 parent 8a1313f commit 93ccbc5
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 30 deletions.
2 changes: 1 addition & 1 deletion RevenueCatUI/CustomerCenter/Views/CustomerCenterView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ private extension CustomerCenterView {
func destinationView(configuration: CustomerCenterConfigData) -> some View {
if viewModel.hasSubscriptions {
if viewModel.subscriptionsAreFromApple,
let screen = configuration[.management] {
let screen = configuration.screens[.management] {
ManageSubscriptionsView(screen: screen)
} else {
WrongPlatformView()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ struct ManageSubscriptionsView_Previews: PreviewProvider {

static var previews: some View {
let viewModel = ManageSubscriptionsViewModel(
screen: CustomerCenterConfigTestData.customerCenterData[.management]!,
screen: CustomerCenterConfigTestData.customerCenterData.screens[.management]!,
subscriptionInformation: CustomerCenterConfigTestData.subscriptionInformation)
ManageSubscriptionsView(viewModel: viewModel)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,8 @@ final class MockManageSubscriptionsPurchases: ManageSubscriptionsPurchaseType {
@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
private extension ManageSubscriptionsViewModelTests {

static let screen: CustomerCenterConfigData.Screen = CustomerCenterConfigTestData.customerCenterData[.management]!
static let screen: CustomerCenterConfigData.Screen =
CustomerCenterConfigTestData.customerCenterData.screens[.management]!

static func createMockProduct() -> StoreProduct {
// Using SK1 products because they can be mocked, but CustomerCenterViewModel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class BackendGetCustomerCenterConfigTests: BaseBackendTests {

expect(result).to(beSuccess())
expect(self.httpClient.calls).to(haveCount(1))
expect(self.httpClient.calls[0].headers["X-Supported-Locales"]) == "en_EN,es_ES"
expect(self.httpClient.calls[0].headers["X-Preferred-Locales"]) == "en_EN,es_ES"
}

func testGetCustomerCenterConfigCallsHTTPMethodWithRandomDelay() {
Expand Down Expand Up @@ -281,33 +281,33 @@ private extension BackendGetCustomerCenterConfigTests {
"localized_strings": [
"cancel": "Cancel",
"back": "Back"
],
] as [String: Any],
"supported": [
"en_US"
]
],
] as [Any]
] as [String: Any],
"screens": [
"MANAGEMENT": [
"paths": [
[
"id": "ownmsldfow",
"title": "Didn't receive purchase",
"type": "MISSING_PURCHASE"
],
] as [String: Any],
[
"id": "nwodkdnfaoeb",
"promotional_offer": [
"ios_offer_id": "rc-refund-offer",
"eligible": true
],
] as [String: Any],
"title": "Request a refund",
"type": "REFUND_REQUEST"
],
] as [String: Any],
[
"id": "nfoaiodifj9",
"title": "Change plans",
"type": "CHANGE_PLANS"
],
] as [String: Any],
[
"feedback_survey": [
"options": [
Expand All @@ -316,62 +316,62 @@ private extension BackendGetCustomerCenterConfigTests {
"promotional_offer": [
"ios_offer_id": "rc-cancel-offer",
"eligible": false
],
] as [String: Any],
"title": "Too expensive"
],
] as [String: Any],
[
"id": "qklpadsfj",
"promotional_offer": [
"ios_offer_id": "rc-cancel-offer",
"eligible": false
],
] as [String: Any],
"title": "Don't use the app"
],
] as [String: Any],
[
"id": "jargnapocps",
"title": "Bought by mistake"
]
],
] as [String: Any]
] as [Any],
"title": "Why are you cancelling?"
],
] as [String: Any],
"id": "jnkasldfhas",
"title": "Cancel subscription",
"type": "CANCEL"
]
],
] as [String: Any]
] as [Any],
"title": "How can we help?",
"type": "MANAGEMENT"
],
] as [String: Any],
"NO_ACTIVE": [
"paths": [
[
"id": "9q9719171o",
"title": "Check purchases",
"type": "MISSING_PURCHASE"
]
],
] as [String: Any]
] as [Any],
"subtitle": "We can try checking your account for any previous purchases",
"title": "No subscriptions found",
"type": "NO_ACTIVE"
]
],
] as [String: Any]
] as [String: Any],
"appearance": [
"dark": [
"accent_color": "#ffffff",
"background_color": "#000000",
"text_color": "#000000"
],
] as [String: Any],
"light": [
"accent_color": "#000000",
"background_color": "#ffffff",
"text_color": "#ffffff"
],
] as [String: Any],
"mode": "CUSTOM"
],
] as [String: Any],
"support": [
"email": "[email protected]"
]
]
] as [String: Any]
] as [String: Any]
]

}

0 comments on commit 93ccbc5

Please sign in to comment.