Skip to content

Commit

Permalink
[no-jira] Fix pledge redemption notifications not working, update tes…
Browse files Browse the repository at this point in the history
…ts (#2175)
  • Loading branch information
leighdouglas authored Nov 21, 2024
1 parent 709b32f commit d3c7fea
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ interface SurveyResponseViewModel {

val pledgeRedemptionUrl = intent()
.filter {
it.hasExtra(IntentKey.NOTIFICATION_PLEDGE_REDEMPTION) && it.getParcelableExtra<SurveyResponse>(IntentKey.NOTIFICATION_PLEDGE_REDEMPTION).isNotNull()
it.hasExtra(IntentKey.NOTIFICATION_PLEDGE_REDEMPTION) && !it.getStringExtra(IntentKey.NOTIFICATION_PLEDGE_REDEMPTION).isNullOrEmpty()
}
.map { requireNotNull(it.getParcelableExtra(IntentKey.NOTIFICATION_PLEDGE_REDEMPTION)) }
.map { requireNotNull(it.getStringExtra(IntentKey.NOTIFICATION_PLEDGE_REDEMPTION)) }
.ofType(String::class.java)
.map { UrlUtils.appendPath(environment.webEndpoint(), it) }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ class DeepLinkViewModelTest : KSRobolectricTestCase() {
@Test
fun testProjectSurveyDeeplink_startsSurveyActivity() {
val url =
"https://www.kickstarter.com/projects/creator/project/surveys/survey-param"
"https://www.kickstarter.com/projects/alexlidell/power-of-five-collectors-edition-omnibus/backing/survey_responses"
setUpEnvironment(intent = intentWithData(url))
startBrowser.assertNoValues()
startDiscoveryActivity.assertNoValues()
Expand All @@ -338,7 +338,7 @@ class DeepLinkViewModelTest : KSRobolectricTestCase() {
@Test
fun testProjectSurveyEditDeeplink_startsSurveyActivity() {
val url =
"https://www.kickstarter.com/projects/creator/project/surveys/survey-param/edit"
"https://www.kickstarter.com/projects/alexlidell/power-of-five-collectors-edition-omnibus/surveys/0/edit"
setUpEnvironment(intent = intentWithData(url))
startBrowser.assertNoValues()
startDiscoveryActivity.assertNoValues()
Expand Down Expand Up @@ -368,7 +368,7 @@ class DeepLinkViewModelTest : KSRobolectricTestCase() {
@Test
fun testProjectSurveyRedeemDeeplink_startsSurveyActivity() {
val url =
"https://www.kickstarter.com/projects/creator/project/backing/redeem"
"https://www.kickstarter.com/projects/alexlidell/power-of-five-collectors-edition-omnibus/backing/redeem"
setUpEnvironment(intent = intentWithData(url))
startBrowser.assertNoValues()
startDiscoveryActivity.assertNoValues()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,15 @@ class SurveyResponseViewModelTest : KSRobolectricTestCase() {
webViewUrl.assertValues("www.kickstarter.com/projects/1231313/test-project-deeplink/backing/survey_responses")
}

@Test
fun `open webview when pledge redemption is opened from notification`() {
val pledgeRedemptionUrlPath = "projects/1231313/test-project-notification/backing/redeem"

setUpEnvironment(environment().toBuilder().webEndpoint("www.test.dev/").build(), Intent().putExtra(IntentKey.NOTIFICATION_PLEDGE_REDEMPTION, pledgeRedemptionUrlPath))

webViewUrl.assertValues("www.test.dev/projects/1231313/test-project-notification/backing/redeem")
}

@After
fun clear() {
disposables.clear()
Expand Down

0 comments on commit d3c7fea

Please sign in to comment.