test: achieve 100% coverage on path-utils.ts
Changes: - Updated Windows path rejection tests to use backslashes as specified - Added comprehensive pathExists() method tests - Reordered validation checks in isValidVaultPath() to ensure Windows absolute paths are caught before invalid character check - This fix ensures the Windows drive letter validation is reachable Coverage improvement: 98.18% -> 100% Tests added: 3 new test cases All 512 tests passing
This commit is contained in:
@@ -59,14 +59,14 @@ export class PathUtils {
|
||||
|
||||
const normalized = this.normalizePath(path);
|
||||
|
||||
// Check for invalid characters (Windows restrictions)
|
||||
const invalidChars = /[<>:"|?*\x00-\x1F]/;
|
||||
if (invalidChars.test(normalized)) {
|
||||
// Check for absolute paths (should be vault-relative)
|
||||
if (normalized.startsWith('/') || /^[A-Za-z]:/.test(normalized)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check for absolute paths (should be vault-relative)
|
||||
if (normalized.startsWith('/') || /^[A-Za-z]:/.test(normalized)) {
|
||||
// Check for invalid characters (Windows restrictions)
|
||||
const invalidChars = /[<>:"|?*\x00-\x1F]/;
|
||||
if (invalidChars.test(normalized)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user