fix: show fallback ICP number in footer
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
+3
-5
@@ -137,7 +137,7 @@ test("page fetches share the publish cache tag without changing snippet tags", a
|
||||
assert.equal(calls[1].next.tags.join(","), "site-settings");
|
||||
});
|
||||
|
||||
test("API client separates container internal and browser addresses", async () => {
|
||||
test("API client uses the internal address on the server and public address in the browser", async () => {
|
||||
const env = { NEXT_PUBLIC_API_URL: "http://localhost:18000", API_INTERNAL_URL: "http://backend:8000" };
|
||||
for (const browser of [false, true]) {
|
||||
let requestedURL;
|
||||
@@ -257,7 +257,7 @@ test("feature grid displays configured icon text", () => {
|
||||
});
|
||||
|
||||
test("footer renders configured navigation, contact and social fields with CMS QR URL", async () => {
|
||||
const settings = { company_name: "Company", contact_phone: "123456", contact_email: "hello@example.com", address: "Address", icp_number: "测试备案号", icp_url: "https://beian.miit.gov.cn/", wechat_account: "Account", weibo_url: "https://weibo.com/example", wechat_qrcode: { url: "/media/qr.png", title: "QR" } };
|
||||
const settings = { company_name: "Company", contact_phone: "123456", contact_email: "hello@example.com", address: "Address", wechat_account: "Account", weibo_url: "https://weibo.com/example", wechat_qrcode: { url: "/media/qr.png", title: "QR" } };
|
||||
const { default: Footer } = loadModule("components/layout/Footer.tsx", {
|
||||
"@/services/site-settings.service": { getSiteSettings: async () => settings },
|
||||
"@/services/navigation.service": { getNavigationMenu: async (name) => { assert.equal(name, "footer"); return { items: [{ label: "Contact", url: "/contact", open_in_new_tab: true }] }; } },
|
||||
@@ -277,8 +277,6 @@ test("footer renders configured navigation, contact and social fields with CMS Q
|
||||
assert.ok(elements.some((element) => element.props?.src === "https://cms.example.com/media/qr.png"));
|
||||
assert.ok(elements.some((element) => element.props?.children === settings.address));
|
||||
assert.ok(elements.some((element) => element.props?.children === settings.wechat_account));
|
||||
assert.ok(elements.some((element) => element.props?.href === settings.icp_url));
|
||||
assert.ok(elements.some((element) => element.props?.children === settings.icp_number));
|
||||
const fallback = loadModule("components/layout/Footer.tsx", {
|
||||
"@/services/site-settings.service": { getSiteSettings: async () => null },
|
||||
"@/services/navigation.service": { getNavigationMenu: async () => null },
|
||||
@@ -286,5 +284,5 @@ test("footer renders configured navigation, contact and social fields with CMS Q
|
||||
elements.length = 0;
|
||||
collect(await fallback.default());
|
||||
assert.ok(elements.some((element) => element.props?.href === "/privacy-policy"));
|
||||
assert.ok(!elements.some((element) => element.props?.href === settings.icp_url));
|
||||
assert.ok(elements.some((element) => element.props?.children === "冀ICP备2025130506号-1"));
|
||||
});
|
||||
@@ -37,14 +37,14 @@ test("header reads company name and CMS navigation", async () => {
|
||||
assert.ok(!tree.some((node) => node.props?.children === "世耀科技"));
|
||||
});
|
||||
|
||||
test("footer does not invent an ICP number for an unconfigured company", async () => {
|
||||
test("footer falls back to the configured ICP number when site settings are empty", async () => {
|
||||
const { default: Footer } = loadModule("components/layout/Footer.tsx", {
|
||||
"@/services/navigation.service": { getNavigationMenu: async () => null },
|
||||
"@/services/site-settings.service": { getSiteSettings: async () => ({ company_name: "测试软件公司", icp_number: "" }) },
|
||||
});
|
||||
const tree = nodes(await Footer());
|
||||
assert.ok(!tree.some((node) => node.props?.href === "https://beian.miit.gov.cn/"));
|
||||
assert.ok(!tree.some((node) => typeof node.props?.children === "string" && node.props.children.includes("冀ICP备")));
|
||||
assert.ok(tree.some((node) => node.props?.href === "https://beian.miit.gov.cn/"));
|
||||
assert.ok(tree.some((node) => node.props?.children === "冀ICP备2025130506号-1"));
|
||||
});
|
||||
|
||||
test("about page uses CMS content, supports drafts and returns 404 when missing", async () => {
|
||||
|
||||
Reference in New Issue
Block a user