Skip to content

test(payments): the country agreement check iterates the module, not a copied list - #236

Merged
mahmutkaya merged 1 commit into
developfrom
test/connect-country-lists-agree
Sep 5, 2026
Merged

mahmutkaya merged 1 commit into
developfrom
test/connect-country-lists-agree

Conversation

@mahmutkaya

Copy link
Copy Markdown
Contributor

The country agreement check iterates the module, not a copied list

A one-line export plus a loop change, and a measured reason.

connectCountryForCurrency decides whether we may mint (currency -> country);
CONNECT_ONBOARDABLE_COUNTRIES decides whether that country is accepted at the request boundary. The
agreement test between them existed already — but it iterated a literal ["CHF","GBP","USD","AED"], a
third hand-maintained copy of the same knowledge.

The failure it was blind to

Add a currency to UNAMBIGUOUS whose country the boundary refuses. The mint then throws inside
createExpressAccount, mintForProposal catches it (by design — it must never throw, its caller chain ends
at the Mollie webhook), and the result is a restaurant that bought online payments, got a tenant without
the module
, and a note in a PR body nobody reads twice. No crash. No red test.

Measured, with the same mutant on both sides

NOK: "NO" added to the map (NO is not onboardable; NOK is referenced nowhere else, so nothing catches
it incidentally):

test result
the previous, hardcoded loop 5 passed — completely blind
this PR's derived loop RED: NOK resolves to NO, which the request boundary would refuse

Mutant verified landed (grep -F) and compiled (tsc exit 0) before either result was read, and reverted
after — tree clean, 6 passing, tsc 0.

(A first attempt used SEK, which the file already uses as its "unknown currency" example, so that test
failed for an unrelated reason and proved nothing about the agreement assertion. The currency was changed
until the mutant isolated the property under test.)

Also added

A positive control on the loop: if RESOLVABLE_CURRENCIES were ever emptied, every assertion inside it would
be skipped and the file would still be green. That assertion is what dies then.

Same defect shape as #225 (a quote and a charge computed independently) and #224 (a crossover sentence
written twice): assert that two sides agree, never that one equals a remembered value.

No behaviour change. RESOLVABLE_CURRENCIES is derived from the existing map.

@sonarqubecloud

sonarqubecloud Bot commented Sep 5, 2026

Copy link
Copy Markdown

@mahmutkaya
mahmutkaya merged commit 6efe707 into develop Sep 5, 2026
18 checks passed
@mahmutkaya
mahmutkaya deleted the test/connect-country-lists-agree branch September 5, 2026 21:13
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.

1 participant