mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2026-11-07 00:38:19 +00:00
Fix CLI filesystem case-sensitivity detection
This commit is contained in:
1 parent
525062f1b5
commit
daa67bea51
6 files changed
+143
-1
No files matched your search
@@ -103,6 +103,44 @@ describe("CLI database preparation", () => {
|
||||
await expect(main(standardIo, runner)).rejects.toThrow(`__EXIT__:${exitCode}`);
|
||||
}
|
||||
|
||||
it.each([
|
||||
{ handleFilenameCaseSensitive: true, pathNormalizationVersion: 0 as const },
|
||||
{ handleFilenameCaseSensitive: true, pathNormalizationVersion: 1 as const },
|
||||
{ handleFilenameCaseSensitive: false, pathNormalizationVersion: 0 as const },
|
||||
{ handleFilenameCaseSensitive: false, pathNormalizationVersion: 1 as const },
|
||||
])(
|
||||
"writes Vault files with case sensitivity $handleFilenameCaseSensitive and path identity $pathNormalizationVersion",
|
||||
async (settings) => {
|
||||
await writeFile(
|
||||
settingsPath,
|
||||
JSON.stringify({ ...createDefaultCliSettings(), ...settings, isConfigured: true })
|
||||
);
|
||||
const writes: boolean[] = [];
|
||||
let failure: unknown;
|
||||
const runner = vi.fn<CliCommandRunner>(async (_options, { core }) => {
|
||||
try {
|
||||
writes.push(
|
||||
await core.serviceModules.storageAccess.writeFileAuto("notes/Remote.md", "remote content")
|
||||
);
|
||||
writes.push(
|
||||
await core.serviceModules.storageAccess.writeFileAuto("notes/Remote.md", "updated content")
|
||||
);
|
||||
} catch (error) {
|
||||
failure = error;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
await start("ls", runner);
|
||||
|
||||
expect(runner).toHaveBeenCalledOnce();
|
||||
expect(failure).toBeUndefined();
|
||||
expect(writes).toEqual([true, true]);
|
||||
expect(await readFile(join(vaultPath, "notes/Remote.md"), "utf8")).toBe("updated content");
|
||||
expect(await readFile(join(vaultPath, "notes/local.md"), "utf8")).toBe("local content");
|
||||
}
|
||||
);
|
||||
|
||||
it.each([
|
||||
{ separator: "/", platform: "POSIX" },
|
||||
{ separator: "\\", platform: "Windows" },
|
||||
|
||||
Reference in new issue
Block a user