返回 CodeWhale
software-application-schema.test.ts
根目录 / web / lib / software-application-schema.test.ts
1 import { describe, expect, it } from "vitest";
2 import { ORGANIZATION_ID } from "./site-schema";
3 import { buildSoftwareApplicationJsonLd } from "./software-application-schema";
4
5 describe("SoftwareApplication structured data", () => {
6 it("uses the published version advertised by the release-backed install URL", () => {
7 const schema = buildSoftwareApplicationJsonLd({ version: "0.9.3" });
8
9 expect(schema.downloadUrl).toBe("https://codewhale.net/en/install");
10 expect(schema.softwareVersion).toBe("0.9.3");
11 expect(schema.author).toEqual({ "@id": ORGANIZATION_ID });
12 });
13
14 it("omits softwareVersion when no published release receipt is available", () => {
15 const schema = buildSoftwareApplicationJsonLd(null);
16
17 expect(schema).not.toHaveProperty("softwareVersion");
18 expect(schema.author).toEqual({ "@id": ORGANIZATION_ID });
19 });
20 });
21
21 lines TYPESCRIPT