This commit is contained in:
parent
728e48fc4f
commit
cc02023625
10 changed files with 341 additions and 39 deletions
|
|
@ -421,9 +421,29 @@ void RunMoneySelfTest() {
|
|||
"content: emergency-calling safety warning present and honest");
|
||||
Check(pr.warranty.find("TODO") == std::string::npos && pr.warranty.size() > 100,
|
||||
"content: warranty is written, not a placeholder");
|
||||
// The product page's schema.org record must parse with our own
|
||||
// JSON parser and carry one offer per colour — the offers are
|
||||
// built from the same integers the checkout charges.
|
||||
{
|
||||
auto pp = Views::RenderProduct(pr, Rates{});
|
||||
auto ld = Json::Parse(pp.meta.jsonLd);
|
||||
bool offersOk = false;
|
||||
if (ld && ld->IsObject()) {
|
||||
if (const Json::Value* o = ld->Find("offers"); o && o->IsArray()) {
|
||||
offersOk = o->array.size() == pr.variants.size();
|
||||
}
|
||||
}
|
||||
Check(ld && ld->IsObject() && ld->Str("@type") == "Product" && offersOk,
|
||||
"schema: product JSON-LD parses, one offer per variant");
|
||||
}
|
||||
}
|
||||
Check(!Content::Projects().empty(), "content: projects present");
|
||||
Check(Content::LegalPages().size() == 3, "content: three legal pages");
|
||||
Check(Content::AboutPage().sections.size() >= 3
|
||||
&& !Content::AboutPage().sections[0].body.empty()
|
||||
&& Content::AboutPage().sections[0].body[0].find("Jorijn van der Graaf")
|
||||
!= std::string::npos,
|
||||
"content: about page names the founder");
|
||||
Check(!Content::Demos().empty(), "content: demos present");
|
||||
}
|
||||
|
||||
|
|
@ -691,7 +711,7 @@ int main(int argc, char** argv) {
|
|||
// --routes: status + title for every route, for a quick smoke check.
|
||||
if (has("--routes")) {
|
||||
const Views::SiteContent content = LoadContent("content");
|
||||
for (std::string_view p : { "/", "/shop", "/shop/fp6-pmos", "/shop/nope",
|
||||
for (std::string_view p : { "/", "/about", "/shop", "/shop/fp6-pmos", "/shop/nope",
|
||||
"/order/0123456789abcdef0123456789abcdef",
|
||||
"/order/not-a-token",
|
||||
"/legal/privacy", "/legal/imprint",
|
||||
|
|
|
|||
Loading…
Reference in a new issue