Files
obsidian-livesync/src/apps/cli/storage/CLIFileNameSource.paths.unit.spec.ts
T
vorotamoroz 2a65fe0117 Maintain watched file names for CLI collision checks
Share the CLI watcher with a reconciled name inventory, observe local
mutations, and retain newer notifications across overlapping reads.
Adopt the shared index for Obsidian and preserve fresh bulk operations.
2026-11-12 14:04:17 +00:00

30 lines
1.2 KiB
TypeScript

import { describe, expect, it } from "vitest";
import type { DirectoryEntry } from "@vrtmrz/livesync-commonlib/storage";
import { findInvalidatedDirectoryScopes } from "./CLIFileNameSource.paths";
describe("physical directory scopes for invalidation", () => {
it.each([true, false])(
"retains every Legacy parent admitted by the effective case policy (sensitive: %s)",
(sensitive) => {
const directories = new Map<string, readonly DirectoryEntry[]>([
[
"",
[
{ name: "Docs", kind: "directory" },
{ name: "docs", kind: "directory" },
{ name: "other", kind: "directory" },
],
],
["Docs", []],
["docs", []],
["other", []],
]);
const scopes = findInvalidatedDirectoryScopes(directories, "docs", {
pathNormalizationVersion: 0,
handleFilenameCaseSensitive: sensitive,
});
expect([...scopes].sort()).toEqual(sensitive ? ["docs"] : ["Docs", "docs"]);
}
);
});