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

Add fakes for data sources in CustomerSheetViewModel #9296

Merged
merged 1 commit into from
Sep 20, 2024

Conversation

samer-stripe
Copy link
Collaborator

@samer-stripe samer-stripe commented Sep 19, 2024

Summary

Add fakes for data sources in CustomerSheetViewModel

Motivation

Manage fakes for individual data source types.

Testing

  • Added tests
  • Modified tests
  • Manually verified

@samer-stripe samer-stripe force-pushed the samer/use-data-source-in-cs-view-model branch 3 times, most recently from 1e36f9b to a15a5c7 Compare September 20, 2024 17:35
@samer-stripe samer-stripe changed the title Samer/create fake data sources Add fakes for data sources in CustomerSheetViewModel Sep 20, 2024
Copy link
Contributor

github-actions bot commented Sep 20, 2024

Diffuse output:

OLD: identity-example-release-base.apk (signature: V1, V2)
NEW: identity-example-release-pr.apk (signature: V1, V2)

          │          compressed          │         uncompressed         
          ├───────────┬───────────┬──────┼───────────┬───────────┬──────
 APK      │ old       │ new       │ diff │ old       │ new       │ diff 
──────────┼───────────┼───────────┼──────┼───────────┼───────────┼──────
      dex │   1.9 MiB │   1.9 MiB │  0 B │     4 MiB │     4 MiB │  0 B 
     arsc │     1 MiB │     1 MiB │  0 B │     1 MiB │     1 MiB │  0 B 
 manifest │   2.3 KiB │   2.3 KiB │  0 B │     8 KiB │     8 KiB │  0 B 
      res │ 301.5 KiB │ 301.5 KiB │  0 B │   455 KiB │   455 KiB │  0 B 
   native │   6.2 MiB │   6.2 MiB │  0 B │  15.8 MiB │  15.8 MiB │  0 B 
    asset │   6.8 KiB │   6.8 KiB │  0 B │   6.5 KiB │   6.5 KiB │  0 B 
    other │  85.5 KiB │  85.5 KiB │ +6 B │ 158.7 KiB │ 158.7 KiB │  0 B 
──────────┼───────────┼───────────┼──────┼───────────┼───────────┼──────
    total │   9.5 MiB │   9.5 MiB │ +6 B │  21.4 MiB │  21.4 MiB │  0 B 

 DEX     │ old   │ new   │ diff      
─────────┼───────┼───────┼───────────
   files │     1 │     1 │ 0         
 strings │ 20244 │ 20244 │ 0 (+0 -0) 
   types │  6082 │  6082 │ 0 (+0 -0) 
 classes │  4886 │  4886 │ 0 (+0 -0) 
 methods │ 29462 │ 29462 │ 0 (+0 -0) 
  fields │ 17389 │ 17389 │ 0 (+0 -0) 

 ARSC    │ old  │ new  │ diff 
─────────┼──────┼──────┼──────
 configs │  164 │  164 │  0   
 entries │ 3608 │ 3608 │  0
APK
   compressed    │   uncompressed   │                        
──────────┬──────┼───────────┬──────┤                        
 size     │ diff │ size      │ diff │ path                   
──────────┼──────┼───────────┼──────┼────────────────────────
 28.3 KiB │ +4 B │  62.6 KiB │  0 B │ ∆ META-INF/CERT.SF     
 25.1 KiB │ +2 B │  62.5 KiB │  0 B │ ∆ META-INF/MANIFEST.MF 
──────────┼──────┼───────────┼──────┼────────────────────────
 53.5 KiB │ +6 B │ 125.1 KiB │  0 B │ (total)

Base automatically changed from samer/use-data-source-in-cs-view-model to master September 20, 2024 20:14
@samer-stripe samer-stripe marked this pull request as ready for review September 20, 2024 21:12
@samer-stripe samer-stripe requested review from a team as code owners September 20, 2024 21:12
Copy link
Collaborator

@amk-stripe amk-stripe left a comment

Choose a reason for hiding this comment

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

nice!! Thanks for making these updates

CustomerSheetDataResult.success(findPaymentMethod(paymentMethods, id))
},
private val onDetachPaymentMethod: DetachPaymentMethodOperation = { id ->
CustomerSheetDataResult.success(findPaymentMethod(paymentMethods, id))
Copy link
Collaborator

Choose a reason for hiding this comment

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

For vertical mode, Jay and I made the default impls of fake functions a not implemented exception. This was useful for ensuring that functions were only called in the tests we expected them to be called in. Just an FYI in case you think this would be useful for customer sheet too!

Copy link
Collaborator Author

@samer-stripe samer-stripe Sep 20, 2024

Choose a reason for hiding this comment

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

Yeah some of the tests were actually expecting values which is why I have them like this. I'll follow up by updating those tests and making these all NotImplemented

onSetupIntentClientSecretForCustomerAttach = {
CustomerAdapter.Result.success("invalid setup intent")
onRetrieveSetupIntentClientSecret = {
CustomerSheetDataResult.success("invalid setup intent")
Copy link
Collaborator

Choose a reason for hiding this comment

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

not necessary to fix in this PR, but should this set up intent be something like si_12345? I feel like that's more consistent with what we usually do for PMs + PIs

Copy link
Collaborator

Choose a reason for hiding this comment

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

or seti_123 which is used below

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Will follow-up!

@samer-stripe samer-stripe merged commit cdc3a4b into master Sep 20, 2024
13 checks passed
@samer-stripe samer-stripe deleted the samer/create-fake-data-sources branch September 20, 2024 23:43
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