markdown fix
All checks were successful
Deploy / build-deploy (push) Successful in 2m23s

This commit is contained in:
Jorijn van der Graaf 2026-08-18 11:12:24 +02:00
commit 4666c1995f
14 changed files with 876 additions and 346 deletions

View file

@ -100,13 +100,16 @@ void CatalogueContract() {
// checkout charges.
{
// The listing's shipping block is now carrier data, so the
// render needs a table. US is priced here on purpose: the
// carrier will happily quote it and the shop still must not
// advertise it.
// render needs a table. Three of these four are priced on purpose
// and must still not be advertised: US is refused on insurance, DE
// and GB on their missing producer registrations. The carrier will
// happily quote all three, which is exactly why the filter is worth
// asserting — CH is the only one here besides home that sells.
const std::vector<ShipRates> feedTable{
{ "NL", { { 2000, 895 } } },
{ "CH", { { 2000, 2450 } } },
{ "DE", { { 2000, 995 } } },
{ "GB", { { 2000, 2450 } } },
{ "GB", { { 2000, 3300 } } },
{ "US", { { 2000, 1794 } } },
};
auto pp = Views::RenderProduct(pr, Rates{}, feedTable);
@ -137,6 +140,13 @@ void CatalogueContract() {
Check(pp.meta.jsonLd.find("\"8.95\"") != std::string::npos
&& pp.meta.jsonLd.find("\"24.50\"") != std::string::npos,
"schema: shipping rates come from the carrier table");
// And nothing the shop refuses is advertised, whatever the carrier
// quotes for it — by rate, so a filter that dropped the country code
// but kept the price would still be caught.
Check(pp.meta.jsonLd.find("\"9.95\"") == std::string::npos
&& pp.meta.jsonLd.find("\"33.00\"") == std::string::npos
&& pp.meta.jsonLd.find("\"17.94\"") == std::string::npos,
"schema: refused destinations are never advertised");
Check(pp.meta.jsonLd.find("\"17.94\"") == std::string::npos
&& pp.meta.jsonLd.find("\"US\"") == std::string::npos,
"schema: a refused destination is never advertised, priced or not");
@ -378,11 +388,23 @@ void CheckoutPreviewData() {
// The blob is a JSON document inside an HTML attribute, so every quote
// arrives escaped — matching the escaped form is matching what the
// browser actually parses back out.
Check(html.find("&quot;x&quot;:[&quot;US&quot;,&quot;CA&quot;]") != std::string_view::npos,
"checkout: the preview carries the no-sale list verbatim");
Check(html.find("&quot;s&quot;:[&quot;RU&quot;,&quot;BY&quot;,&quot;KP&quot;]")
!= std::string_view::npos,
"checkout: the preview carries the sanctions list verbatim");
// `w` is the shipping ALLOW-list: the preview refuses a country by its
// ABSENCE here, which is why the payload stays five codes long instead of
// enumerating the two hundred that are closed.
Check(html.find("&quot;w&quot;:[&quot;NL&quot;,&quot;CH&quot;,&quot;AU&quot;,"
"&quot;HK&quot;,&quot;SG&quot;,&quot;RS&quot;,&quot;ME&quot;,"
"&quot;AL&quot;,&quot;XK&quot;,&quot;GE&quot;]") != std::string_view::npos,
"checkout: the preview carries the shipping allow-list verbatim");
Check(html.find("&quot;US&quot;") == std::string_view::npos,
"checkout: no deny-list survives in the preview payload");
// Both refusals ship their own sentence, or the preview would word a decline
// differently from the submit that follows it.
Check(html.find("&quot;sm&quot;") != std::string_view::npos
&& html.find("&quot;rm&quot;") != std::string_view::npos,
"checkout: the preview carries a message for each refusal");
// The unit weight, which is what selects a bracket out of the carrier
// table the same blob carries.
Check(html.find("&quot;g&quot;:700") != std::string_view::npos,