polygonhunter_searchosaurus/tests/classify.test.ts
polygonhunter e3cc05cef2 M1: scaffold, search index, and basic modal
Project scaffold following the Scalosaurus conventions (esbuild, strict
tsconfig, vitest, test-vault with hot-reload, dispatch release workflow).

Core (pure, unit-tested): MiniSearch engine with title-dominant field
boosts, diacritic/ß folding shared across index/query/tier layers, and
extension→kind classification. Obsidian side: chunked vault indexing
with mtime diff against an IndexedDB startup cache and incremental
updates from metadataCache/vault events. Basic SuggestModal lists
boosted results; deterministic title tiers land with the ranking
milestone.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-16 07:53:35 +00:00

20 lines
613 B
TypeScript

import { describe, expect, it } from "vitest";
import { kindForExtension } from "../src/core/classify";
describe("kindForExtension", () => {
it("maps markdown to note", () => {
expect(kindForExtension("md")).toBe("note");
});
it("maps image extensions to image, case-insensitively", () => {
for (const ext of ["png", "jpg", "jpeg", "webp", "gif", "bmp", "PNG", "JPG"]) {
expect(kindForExtension(ext)).toBe("image");
}
});
it("maps everything else to file", () => {
for (const ext of ["pdf", "docx", "xlsx", "canvas", "mp3", "zip"]) {
expect(kindForExtension(ext)).toBe("file");
}
});
});