Repository navigation
Add test coverage for a claimed req- parameter - #15
caarloshenriq wants to merge 1 commit into
Conversation
Closes payjoin#7 `required_understood` tested that a non-`req-` unknown parameter is silently ignored, not that a `req-` parameter someone claims lets the URI parse. Rename it to say what it actually covers, and add the missing case: an Extras implementation that claims a `req-` key must not error, the same way payjoin's `pj`/`pjos` already don't. A third test confirms claiming one `req-` key doesn't excuse a different unclaimed one. Test-only change, no production code touched.
DanGould
left a comment
There was a problem hiding this comment.
concept NACK
a
req-key anExtrasimplementation does claim must not cause a parse error
I'm a bit confused by this PR.
From bip21 § forward compatibility
variables which are prefixed with a req- are considered required. If a client does not implement any variables which are prefixed with req-, it MUST consider the entire URI invalid. Any other variables which are not implemented, but which are not prefixed with a req-, can be safely ignored.
It seems like this test enforces non-spec behavior, when perhaps it should be fixing the behavior if it's wrong.
Agreed, this pinned current behavior rather than the spec. Under #12 the parser never errors on |
Fixes #7
required_not_understoodabove only covered areq-key nobody claims. It never covered the other half: areq-key anExtrasimplementation does claim must not cause a parse error, the same waypj/pjosalready don't for payjoin.Renames a misleadingly-named existing test (
required_understood->non_required_unknown_params_are_silently_ignored): the old name claimed to cover req- enforcement, but the params it uses don't carry the req- prefix at all, so what it actually tests is that plain unknown (non-req-) params are silently ignored rather than rejected.Adds two new tests: a claimed req- parameter parses successfully, and an unclaimed req- parameter alongside a claimed one still fails (claiming one key does not excuse an unrelated unclaimed one).
Test-only change, no production code touched.
Related to #14, which adds
unsatisfied_requirements()for the other side of that same acceptance item in #12 - together they close it.