MCPcopy Create free account
hub / github.com/callumalpass/tasknotes / createContext

Function createContext

tests/unit/ui/taskCardPropertyAccess.test.ts:19–37  ·  view source on GitHub ↗
(options: {
	mapping?: Record<string, string | null | undefined>;
	frontmatter?: Record<string, unknown>;
	userFields?: Array<{ id?: string; key?: string }>;
} = {})

Source from the content-addressed store, hash-verified

17}
18
19function createContext(options: {
20 mapping?: Record<string, string | null | undefined>;
21 frontmatter?: Record<string, unknown>;
22 userFields?: Array<{ id?: string; key?: string }>;
23} = {}): TaskCardPropertyAccessContext {
24 return {
25 fieldMapper: {
26 lookupMappingKey: (propertyId: string) => options.mapping?.[propertyId] ?? null,
27 },
28 settings: {
29 userFields: options.userFields ?? [],
30 },
31 app: {
32 metadataCache: {
33 getCache: () => ({ frontmatter: options.frontmatter }),
34 },
35 },
36 };
37}
38
39describe("TaskCard property access", () => {
40 it("resolves mapped core properties before raw property IDs", () => {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected