Refresh HiveGrid Cloud reference snapshot

This commit is contained in:
david committed 2026-08-03 15:31:14 +02:00
1 parent 5e99e14772
commit 7f88026f79
5955 files changed
+1177325 -188362

No files matched your search

@@ -4,7 +4,8 @@ vi.mock("./db/appConfiguration.db.server", () => ({
getAppConfiguration: vi.fn(),
}));
vi.mock("~/locale/i18n", () => ({
vi.mock("~/locale/i18n", async (importOriginal) => ({
...(await importOriginal<typeof import("~/locale/i18n")>()),
i18nConfig: { supportedLngs: ["en"], fallbackLng: "en" },
}));
@@ -24,7 +25,15 @@ vi.mock("~/modules/knowledgeBase/utils/KnowledgeBaseUtils", () => ({
},
}));
import { getSitemapDomainUrl, isAdminHostSitemapRoute, shouldSkipSitemapRouteId } from "./sitemap.server";
vi.mock("~/modules/knowledgeBase/services/publicKnowledgeBaseRls.server", () => ({
withPublicKnowledgeBaseRlsContext: vi.fn(async (_slug: string, operation: () => Promise<unknown>) => operation()),
}));
import KnowledgeBaseServiceServer from "~/modules/knowledgeBase/service/KnowledgeBaseService.server";
import { withPublicKnowledgeBaseRlsContext } from "~/modules/knowledgeBase/services/publicKnowledgeBaseRls.server";
import KnowledgeBaseUtils from "~/modules/knowledgeBase/utils/KnowledgeBaseUtils";
import { getAppConfiguration } from "./db/appConfiguration.db.server";
import { getSitemapDomainUrl, getSitemapXml, isAdminHostSitemapRoute, shouldSkipSitemapRouteId } from "./sitemap.server";
describe("getSitemapDomainUrl", () => {
test("uses canonical routing config instead of request hosts", () => {
@@ -50,4 +59,32 @@ describe("getSitemapDomainUrl", () => {
expect(isAdminHostSitemapRoute("/acme/dashboard")).toBe(false);
expect(isAdminHostSitemapRoute("/login")).toBe(false);
});
test("enumerates only resolver-approved public knowledge bases and scopes their descendants", async () => {
vi.mocked(getAppConfiguration).mockResolvedValue({ subscription: { allowSignUpBeforeSubscribe: true } } as never);
vi.mocked(KnowledgeBaseServiceServer.getAll).mockResolvedValue([
{
id: "kb-public",
slug: "docs",
createdAt: new Date("2026-07-14T00:00:00.000Z"),
updatedAt: null,
defaultLanguage: "de",
} as never,
]);
vi.mocked(KnowledgeBaseServiceServer.getCategories).mockResolvedValue([{ id: "category-public" } as never]);
vi.mocked(KnowledgeBaseServiceServer.getArticles).mockResolvedValue([{ id: "article-public", updatedAt: null, createdAt: new Date() } as never]);
vi.mocked(KnowledgeBaseUtils.getKbUrl).mockReturnValue("/docs");
vi.mocked(KnowledgeBaseUtils.getCategoryUrl).mockReturnValue("/docs/categories/public");
vi.mocked(KnowledgeBaseUtils.getArticleUrl).mockReturnValue("/docs/articles/public");
const xml = await getSitemapXml(new Request("https://app.example.test/sitemap.xml"), {
routeModules: {},
manifest: { routes: {} },
} as never);
expect(KnowledgeBaseServiceServer.getAll).toHaveBeenCalledWith(expect.objectContaining({ enabled: true, publicOnly: true }));
expect(withPublicKnowledgeBaseRlsContext).toHaveBeenCalledWith("docs", expect.any(Function));
expect(xml).toContain("/docs/categories/public");
expect(xml).toContain("/docs/articles/public");
});
});