test: comprehensive coverage for NoteTools
Add extensive test suite for note-tools.ts covering all major operations and error paths. Improves statement coverage from 13.94% to 96.01%. Tests added: - readNote: success, errors, frontmatter parsing - createNote: success, conflict strategies (error/overwrite/rename), parent folder creation - updateNote: success, errors, waypoint protection - deleteNote: soft/permanent delete, dry run, version checking - renameFile: success, errors, version checking, parent folder creation - readExcalidraw: success, non-Excalidraw files, errors - updateFrontmatter: success, field removal, version checking - updateSections: success, invalid ranges, version checking - Path validation for all methods - Empty path validation for all methods Mock enhancements: - Added modify, delete, trash methods to VaultAdapter mock - Added parseYaml function to Obsidian mock for frontmatter testing Coverage improvements for note-tools.ts: - Statements: 13.94% -> 96.01% (+82.07%) - Branches: 5.1% -> 88.44% (+83.34%) - Functions: 27.27% -> 90.9% (+63.63%) - Lines: 13.94% -> 96.4% (+82.46%)
This commit is contained in:
@@ -14,6 +14,9 @@ export function createMockVaultAdapter(overrides?: Partial<IVaultAdapter>): IVau
|
||||
process: jest.fn(),
|
||||
createFolder: jest.fn(),
|
||||
create: jest.fn(),
|
||||
modify: jest.fn(),
|
||||
delete: jest.fn(),
|
||||
trash: jest.fn(),
|
||||
...overrides
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user