Skip to content

Commit 0d1d28a

Browse files
santugowdaclaude
andcommitted
test(PayPal): update instrumentation tests for dropped app_switch_context.native_app
createRequestBody no longer emits the nested app_switch_context.native_app structure, so the instrumentation tests now assert the flat app switch fields (os_type, os_version, merchant_app_return_url) and that app_switch_context is absent. Fixes the failing PayPal instrumentation tests on this branch. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent a448ff3 commit 0d1d28a

2 files changed

Lines changed: 11 additions & 9 deletions

File tree

PayPal/src/androidTest/java/com/braintreepayments/api/paypal/PayPalCheckoutRequestTest.kt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -330,10 +330,10 @@ class PayPalCheckoutRequestTest {
330330

331331
val json = JSONObject(result)
332332
assertTrue(json.getBoolean("launch_paypal_app"))
333-
val nativeApp = json.getJSONObject("app_switch_context").getJSONObject("native_app")
334-
assertEquals("ANDROID", nativeApp.getString("os_type"))
335-
assertNotNull(nativeApp.getString("os_version"))
336-
assertEquals("https://merchant.example.com/applink", nativeApp.getString("app_url"))
333+
assertEquals("Android", json.getString("os_type"))
334+
assertNotNull(json.getString("os_version"))
335+
assertEquals("https://merchant.example.com/applink", json.getString("merchant_app_return_url"))
336+
assertFalse(json.has("app_switch_context"))
337337
}
338338

339339
@Test
@@ -354,6 +354,8 @@ class PayPalCheckoutRequestTest {
354354

355355
val json = JSONObject(result)
356356
assertFalse(json.has("launch_paypal_app"))
357+
assertFalse(json.has("os_type"))
358+
assertFalse(json.has("merchant_app_return_url"))
357359
assertFalse(json.has("app_switch_context"))
358360
}
359361

PayPal/src/androidTest/java/com/braintreepayments/api/paypal/PayPalVaultRequestTest.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ class PayPalVaultRequestTest {
141141
}
142142

143143
@Test
144-
fun createRequestBody_withAppSwitchEnabled_returnsNestedNativeAppStructure() {
144+
fun createRequestBody_withAppSwitchEnabled_includesAppSwitchParams() {
145145
val request = PayPalVaultRequest(hasUserLocationConsent = true).apply {
146146
enablePayPalAppSwitch = true
147147
}
@@ -156,10 +156,10 @@ class PayPalVaultRequestTest {
156156

157157
val json = JSONObject(result)
158158
assertTrue(json.getBoolean("launch_paypal_app"))
159-
val nativeApp = json.getJSONObject("app_switch_context").getJSONObject("native_app")
160-
assertEquals("ANDROID", nativeApp.getString("os_type"))
161-
assertNotNull(nativeApp.getString("os_version"))
162-
assertEquals("https://merchant.example.com/applink", nativeApp.getString("app_url"))
159+
assertEquals("Android", json.getString("os_type"))
160+
assertNotNull(json.getString("os_version"))
161+
assertEquals("https://merchant.example.com/applink", json.getString("merchant_app_return_url"))
162+
assertFalse(json.has("app_switch_context"))
163163
}
164164

165165
@Test

0 commit comments

Comments
 (0)