diff --git a/apps/storefront/scripts/optional-graphql.test.mjs b/apps/storefront/scripts/optional-graphql.test.mjs index 668f98a..f5c755a 100644 --- a/apps/storefront/scripts/optional-graphql.test.mjs +++ b/apps/storefront/scripts/optional-graphql.test.mjs @@ -54,13 +54,26 @@ test("recognizes only the requested optional field and parent type", () => { }); test("recognizes errors caused only by unavailable optional GraphQL types", () => { - const commerceTypes = ["Product", "ProductBrand", "ProductCategory", "ProductTag"]; + const commerceTypes = [ + "ExternalProduct", + "GroupProduct", + "Product", + "ProductBrand", + "ProductCategory", + "ProductTag", + "SimpleProduct", + "VariableProduct", + ]; assert.equal( hasOnlyUnknownTypes( [ { message: 'Unknown type "Product".' }, { message: 'Unknown type "ProductCategory". Did you mean "Category"?' }, + { message: 'Unknown type "ExternalProduct".' }, + { message: 'Unknown type "GroupProduct".' }, + { message: 'Unknown type "SimpleProduct".' }, + { message: 'Unknown type "VariableProduct".' }, ], commerceTypes, ), diff --git a/apps/storefront/scripts/prerender-language-fallback.test.mjs b/apps/storefront/scripts/prerender-language-fallback.test.mjs index 00fbf21..d26d9ca 100644 --- a/apps/storefront/scripts/prerender-language-fallback.test.mjs +++ b/apps/storefront/scripts/prerender-language-fallback.test.mjs @@ -21,6 +21,10 @@ test("prerender uses the WordPress site language when Polylang is unavailable", }); test("prerender retries commerce route discovery without multilingual WooCommerce metadata", () => { + assert.match( + prerenderSource, + /const COMMERCE_ROUTE_TYPES = \[[\s\S]*?"ExternalProduct"[\s\S]*?"GroupProduct"[\s\S]*?"SimpleProduct"[\s\S]*?"VariableProduct"/, + ); assert.match( prerenderSource, /!backendLanguageFieldsAvailable[\s\S]*?error instanceof GraphqlHttpError[\s\S]*?error\.status >= 500/, diff --git a/apps/storefront/scripts/prerender.mjs b/apps/storefront/scripts/prerender.mjs index 447cac8..33602e6 100644 --- a/apps/storefront/scripts/prerender.mjs +++ b/apps/storefront/scripts/prerender.mjs @@ -82,7 +82,16 @@ const backendProfile = ["shell", "blog", "shop", "full"].includes(configuredBack ? configuredBackendProfile : "full"; const commerceRoutesAvailable = backendProfile === "shop" || backendProfile === "full"; -const COMMERCE_ROUTE_TYPES = ["Product", "ProductBrand", "ProductCategory", "ProductTag"]; +const COMMERCE_ROUTE_TYPES = [ + "ExternalProduct", + "GroupProduct", + "Product", + "ProductBrand", + "ProductCategory", + "ProductTag", + "SimpleProduct", + "VariableProduct", +]; const expectedLanguages = (process.env.STOREFRONT_EXPECTED_LOCALES || "") .split(",") .map((locale) => locale.trim().toLowerCase())