mirror of
https://github.com/polygonhunter/searchosaurus.git
synced 2026-07-22 08:30:27 +00:00
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>
20 lines
613 B
TypeScript
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");
|
|
}
|
|
});
|
|
});
|