mirror of
https://github.com/mderman/context_nine_obsidian_plugin.git
synced 2026-07-22 07:24:23 +00:00
21 lines
791 B
TypeScript
21 lines
791 B
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { firstContextValue, taskContextFromFrontmatter } from "../src/task-context";
|
|
|
|
describe("task context router", () => {
|
|
it("reads first context from TaskNotes frontmatter arrays", () => {
|
|
expect(firstContextValue(["03-impression", "02-matt-derman"])).toBe("03-impression");
|
|
});
|
|
|
|
it("reads first context from comma-delimited strings", () => {
|
|
expect(firstContextValue("03-impression, 02-matt-derman")).toBe("03-impression");
|
|
});
|
|
|
|
it("uses mapped TaskNotes context field", () => {
|
|
expect(
|
|
taskContextFromFrontmatter(
|
|
{ taskContexts: ["02-matt-derman"] },
|
|
{ fieldMapper: { toUserField: (field) => (field === "contexts" ? "taskContexts" : field) } }
|
|
)
|
|
).toBe("02-matt-derman");
|
|
});
|
|
});
|