use kimun_notes::cli::helpers::resolve_note_path;
#[test]
fn test_relative_path_joined_with_quick_note_path() {
let path = resolve_note_path("my-note", "/inbox").unwrap();
assert_eq!(path.to_string(), "/inbox/my-note.md");
}
#[test]
fn test_relative_path_no_extension_gets_md() {
let path = resolve_note_path("ideas/thing", "/notes").unwrap();
assert_eq!(path.to_string(), "/notes/ideas/thing.md");
}
#[test]
fn test_explicit_md_extension_not_doubled() {
let path = resolve_note_path("my-note.md", "/inbox").unwrap();
assert_eq!(path.to_string(), "/inbox/my-note.md");
}
#[test]
fn test_absolute_path_ignores_quick_note_path() {
let path = resolve_note_path("/projects/idea", "/inbox").unwrap();
assert_eq!(path.to_string(), "/projects/idea.md");
}
#[test]
fn test_absolute_path_with_md_not_doubled() {
let path = resolve_note_path("/projects/idea.md", "/inbox").unwrap();
assert_eq!(path.to_string(), "/projects/idea.md");
}
#[test]
fn test_empty_path_returns_error() {
let result = resolve_note_path("", "/inbox");
assert!(result.is_err(), "empty path should return an error");
}
#[test]
fn test_whitespace_only_path_returns_error() {
let result = resolve_note_path(" ", "/inbox");
assert!(result.is_err(), "whitespace-only path should return an error");
}
#[test]
fn test_quick_note_path_root_default() {
let path = resolve_note_path("my-note", "/").unwrap();
assert_eq!(path.to_string(), "/my-note.md");
}
#[test]
fn test_empty_quick_note_path_uses_root() {
let path = resolve_note_path("my-note", "").unwrap();
assert_eq!(path.to_string(), "/my-note.md");
}
#[test]
fn test_root_separator_only_returns_error() {
let result = resolve_note_path("/", "/inbox");
assert!(result.is_err(), "bare separator should return an error");
}