Skip to content

armgit / jan

Public Imported from GitHub
0

Jan is an open source alternative to ChatGPT that runs 100% offline on your computer.

test(filesystem): compare read paths in the resolver's form so the test holds on Windows

James Dam5ac7a3941126
diff --git a/src-tauri/src/core/filesystem/helpers.rs b/src-tauri/src/core/filesystem/helpers.rs
index 8c33e4d37..2409879e8 100644
--- a/src-tauri/src/core/filesystem/helpers.rs
+++ b/src-tauri/src/core/filesystem/helpers.rs
@@ -243,7 +243,9 @@ mod tests {
fs::create_dir_all(data.join("models")).unwrap();
let resolved = resolve_read_path(&data, "models").expect("resolves");
- assert!(resolved.starts_with(data.canonicalize().unwrap()));
+ // Compare in the resolver's own form: on Windows `canonicalize` adds a
+ // `\\?\` prefix that the resolver strips.
+ assert!(resolved.starts_with(normalize_scope_path(canonicalize_for_scope(&data))));
let resolved = resolve_read_path(&data, "file://models").expect("resolves");
assert!(resolved.ends_with("models"));
assert!(resolve_read_path(&data, "../elsewhere").is_err());