Skip to content

Add Google Pay golden request tests - #70

Open
Max Harrison (maxharrison) wants to merge 1 commit into
max/gpay-billing-address-default-v2from
max/gpay-golden-requests
Open

Add Google Pay golden request tests#70
Max Harrison (maxharrison) wants to merge 1 commit into
max/gpay-billing-address-default-v2from
max/gpay-golden-requests

Conversation

@maxharrison

@maxharrison Max Harrison (maxharrison) commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

The Android Google Pay request had no whole-request test, so defaults and configured fields could change without a focused failure. GooglePayGoldenRequestTest now compares billing-disabled, billing-enabled, and custom requests with strict JSON fixtures.

The shared projection excludes Android-only displayItems[].status; a separate test covers that field. The fixtures match the web SDK copies byte-for-byte, but no CI check enforces that yet.

Stacked on #72. Both PRs must wait for the next major Android SDK release.

The Android Google Pay request had no structural fixture tests, so a
default or a configured field could drift from the web SDK without a
focused failure.

GooglePayGoldenRequestTest compares the full request projection with
billing-enabled, billing-disabled, and custom fixtures.

The fixtures are shared with the web SDK under
packages/ui-components/test/fixtures/google-pay.
private val transaction = Transaction(
country = "IE",
currency = "EUR",
total = Amount.ofMinorUnits(5499),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: we use Amount.ofMinorUnits(5499) here vs. Amount("54.99") in the neighboring PaymentRequestTest.kt - maybe a good idea to stick to just one of them
(functionally identical, just an inconsistent style choice between the two test files)

Doesn't have to be part of this pr though.

* Fixture tests for the whole Google Pay payment request.
*
* These fixtures are shared with the web SDK's `packages/ui-components/test/fixtures/google-pay`.
* Keep the two copies identical so a default that drifts on one platform fails here.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We can create a claude bot (similar to Matt's one that checks docs vs code changes) to check every now and then that the fixtures are identical (for Android and iOS)
Or there might be ready solutions for that

I don't think we have time and/or need to do it as part of this project, but could be a good ticket for the next iteration or just a backlog.

@ana-maksimovskikh ana-maksimovskikh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM, thanks you 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants