Add a Wikidata export connector for a pinned CC0 computing field.
All checks were successful
synthetic / suite (push) Successful in 1m2s
All checks were successful
synthetic / suite (push) Successful in 1m2s
The connector maps native Q-ids to aliases under urn:ce ids, publishes only through the existing rights and reference gate, and leaves the real-user pilot open. Assistant: grok Assistant-Session: 01a15378-f601-7fe2-a143-8e1500a1d59c
This commit is contained in:
parent
8bcb3414d7
commit
55f6180b8e
15 changed files with 1819 additions and 10 deletions
37
ui/lib/computing-basics.test.ts
Normal file
37
ui/lib/computing-basics.test.ts
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
import { readFileSync } from "node:fs";
|
||||
import { join } from "node:path";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { entitySlug, findDataspace, findEntity, findKind } from "./catalog";
|
||||
|
||||
const directory = join(process.cwd(), "../examples/dataspaces/computing-basics");
|
||||
|
||||
describe("computing-basics catalog", () => {
|
||||
it("reads kind labels and an entity title from the published dataspace", () => {
|
||||
const snapshot = JSON.parse(readFileSync(join(directory, "snapshot.json"), "utf8")) as {
|
||||
dataspace: { id: string; title: string };
|
||||
kinds: { id: string; label: string }[];
|
||||
entities: { id: string; kindId: string; title: string }[];
|
||||
sources: { id: string; title: string; license: string }[];
|
||||
};
|
||||
const manifest = JSON.parse(readFileSync(join(directory, "manifest.json"), "utf8")) as {
|
||||
kindViews: Record<string, { columns: string[] }>;
|
||||
home: { featuredKinds: string[] };
|
||||
};
|
||||
const kindId = manifest.home.featuredKinds[0];
|
||||
const declared = snapshot.kinds.find((kind) => kind.id === kindId);
|
||||
const kind = findKind(snapshot.dataspace.id, kindId);
|
||||
expect(declared).toBeTruthy();
|
||||
expect(kind?.label).toBe(declared?.label);
|
||||
expect(kind?.columns.map((column) => column.key)).toEqual(manifest.kindViews[kindId].columns);
|
||||
|
||||
const entity = snapshot.entities.find((item) => item.kindId === kindId);
|
||||
expect(entity).toBeTruthy();
|
||||
const view = findEntity(snapshot.dataspace.id, kindId, entitySlug(entity!.id, kindId));
|
||||
const source = snapshot.sources[0];
|
||||
expect(view?.title).toBe(entity?.title);
|
||||
expect(
|
||||
view?.sources.some((item) => item.title === source.title || item.license === source.license),
|
||||
).toBe(true);
|
||||
expect(findDataspace(snapshot.dataspace.id)?.title).toBe(snapshot.dataspace.title);
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue