test: add vault-tools defensive code coverage
- Added test for getFolderWaypoint file read error handling (line 777) - Documented unreachable defensive code in stat() (lines 452-456) - Documented unreachable defensive code in exists() (lines 524-528) - Added istanbul ignore comments for unreachable defensive returns Analysis: - Lines 452-456 and 524-528 are unreachable because getAbstractFileByPath only returns TFile, TFolder, or null - all cases are handled before the defensive fallback code - Line 777 is now covered by testing file read errors in getFolderWaypoint Coverage: vault-tools.ts now at 100% statement coverage (99.8% tools overall) Test count: 84 vault-tools tests, 505 total tests passing
This commit is contained in:
@@ -448,11 +448,16 @@ export class VaultTools {
|
||||
};
|
||||
}
|
||||
|
||||
// Path doesn't exist (shouldn't reach here)
|
||||
// DEFENSIVE CODE - UNREACHABLE
|
||||
// This code is unreachable because getAbstractFileByPath only returns TFile, TFolder, or null.
|
||||
// All three cases are handled above (null at line 405, TFile at line 420, TFolder at line 436).
|
||||
// TypeScript requires exhaustive handling, so this defensive return is included.
|
||||
/* istanbul ignore next */
|
||||
const result: StatResult = {
|
||||
path: normalizedPath,
|
||||
exists: false
|
||||
};
|
||||
/* istanbul ignore next */
|
||||
return {
|
||||
content: [{
|
||||
type: "text",
|
||||
@@ -520,11 +525,16 @@ export class VaultTools {
|
||||
};
|
||||
}
|
||||
|
||||
// Path doesn't exist (shouldn't reach here)
|
||||
// DEFENSIVE CODE - UNREACHABLE
|
||||
// This code is unreachable because getAbstractFileByPath only returns TFile, TFolder, or null.
|
||||
// All three cases are handled above (null at line 479, TFile at line 494, TFolder at line 509).
|
||||
// TypeScript requires exhaustive handling, so this defensive return is included.
|
||||
/* istanbul ignore next */
|
||||
const result: ExistsResult = {
|
||||
path: normalizedPath,
|
||||
exists: false
|
||||
};
|
||||
/* istanbul ignore next */
|
||||
return {
|
||||
content: [{
|
||||
type: "text",
|
||||
|
||||
Reference in New Issue
Block a user