mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2026-11-14 20:20:12 +00:00
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.
30 lines
1.2 KiB
TypeScript
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"]);
|
|
}
|
|
);
|
|
});
|