test: Enhance sitemap tests to validate presence of dynamic sections

This commit is contained in:
Nawaz Dhandala
2025-08-19 10:07:11 +01:00
parent 17bdfee012
commit 9f4869b05f
2 changed files with 6 additions and 1 deletions

View File

@@ -49,18 +49,23 @@ test.describe("Home: Sitemap", () => {
// Ensure at least one dynamic section appears
const hasBlog: boolean = locs.some((l: string) => {
// eslint-disable-next-line prettier/prettier
return (/\/blog\b/).test(l);
});
const hasCompare: boolean = locs.some((l: string) => {
// eslint-disable-next-line prettier/prettier
return (/\/compare\//).test(l);
});
const hasProductPages: boolean = locs.some((l: string) => {
// eslint-disable-next-line prettier/prettier
return (/\/product\//).test(l);
});
const hasDocs: boolean = locs.some((l: string) => {
// eslint-disable-next-line prettier/prettier
return (/\/docs\//).test(l);
});
const hasLegal: boolean = locs.some((l: string) => {
// eslint-disable-next-line prettier/prettier
return (/\/legal\//).test(l);
});
expect(hasBlog).toBeTruthy();

View File

@@ -40,7 +40,7 @@ const HomeFeatureSet: FeatureSet = {
res.locals["homeUrl"] = (await DatabaseConfig.getHomeUrl())
.toString()
.replace(/\/$/, "");
} catch (_err) {
} catch {
// Fallback hard-coded production domain if env misconfigured
res.locals["homeUrl"] = "https://oneuptime.com";
}