mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2026-07-24 13:32:59 +00:00
refactor: inject CLI I/O and diagnostics
This commit is contained in:
@@ -138,11 +138,13 @@ describe("IgnoreRules", () => {
|
||||
const vaultPath = await createVault();
|
||||
// Typo: "import:.gitignore" instead of "import: .gitignore"
|
||||
await writeIgnoreFile(vaultPath, "*.tmp\nimport:.gitignore\n");
|
||||
const rules = new IgnoreRules(vaultPath);
|
||||
const reportDiagnostic = vi.fn();
|
||||
const rules = new IgnoreRules(vaultPath, reportDiagnostic);
|
||||
await rules.load();
|
||||
// *.tmp still loaded; import:.gitignore is skipped (not treated as a literal pattern)
|
||||
expect(rules.shouldIgnore("scratch.tmp")).toBe(true);
|
||||
expect(rules.shouldIgnore("import:.gitignore")).toBe(false);
|
||||
expect(reportDiagnostic).toHaveBeenCalledWith(expect.stringContaining("unrecognised directive"));
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user