Skip to content

refactor(bg): pass constructible classes in deps for testability#1096

Merged
sidvishnoi merged 2 commits into
mainfrom
testable-paymentmanager
Jun 13, 2025
Merged

refactor(bg): pass constructible classes in deps for testability#1096
sidvishnoi merged 2 commits into
mainfrom
testable-paymentmanager

Conversation

@sidvishnoi

Copy link
Copy Markdown
Member

Context

Had some errors when trying to test PaymentManager class - as jest didn't quite like the imports - open-payments SDK caused issues with testing.

Changes proposed in this pull request

  • Add PaymentManager and PaymentSession to awilix Cradle
  • From Monetization, call the PaymentManager from dependency, instead of importing.
  • From PaymentManager, call the PaymentSession from dependency, instead of importing.

Makes things easier to mock in tests now.

@sidvishnoi sidvishnoi requested a review from DarianM June 13, 2025 11:48
@github-actions github-actions Bot added the area: background Improvements or additions to extension background script label Jun 13, 2025
@github-actions

github-actions Bot commented Jun 13, 2025

Copy link
Copy Markdown
Contributor

Extension builds preview

Name Link
Latest commit 5020563
Latest job logs Run #15635573929
Chrome (992.3KB)Download
Firefox (992.33KB)Download

Comment thread src/background/services/paymentManager.ts
@sidvishnoi sidvishnoi merged commit 8b6d10c into main Jun 13, 2025
7 checks passed
@sidvishnoi sidvishnoi deleted the testable-paymentmanager branch June 13, 2025 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: background Improvements or additions to extension background script

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants