mirror of
https://github.com/joelhooks/joelclaw.git
synced 2026-09-19 01:24:04 +08:00
0295660e3e
- vault-read.ts (209 lines) → @joelclaw/vault-reader, 4 tests - AST formatter wired in telegram.ts behind USE_AST_FORMATTER flag - Fixed TS errors: type-only import, non-null assertions, break vs lineBreak - 31 tests green across markdown-formatter, vault-reader, message-store
35 lines
996 B
TypeScript
35 lines
996 B
TypeScript
import { describe, expect, test } from "vitest";
|
|
import { extractVaultIntent } from "../src";
|
|
|
|
describe("extractVaultIntent", () => {
|
|
test("returns path kind for explicit paths", () => {
|
|
expect(extractVaultIntent("Please read /Users/joel/Vault/docs/decisions/adr-0120.md")).toEqual({
|
|
kind: "path",
|
|
value: "/Users/joel/Vault/docs/decisions/adr-0120.md",
|
|
});
|
|
});
|
|
|
|
test("returns adr kind for ADR references", () => {
|
|
expect(extractVaultIntent("Can you open ADR 123?")).toEqual({
|
|
kind: "adr",
|
|
value: "123",
|
|
});
|
|
|
|
expect(extractVaultIntent("Can you open adr-123?")).toEqual({
|
|
kind: "adr",
|
|
value: "123",
|
|
});
|
|
});
|
|
|
|
test("returns fuzzy kind for plain text", () => {
|
|
expect(extractVaultIntent("read about project launch planning")).toEqual({
|
|
kind: "fuzzy",
|
|
value: "about project launch planning",
|
|
});
|
|
});
|
|
|
|
test("returns null for empty input", () => {
|
|
expect(extractVaultIntent("\n ")).toBeNull();
|
|
});
|
|
});
|