fix: follow-ups of the lot-v018 stack reviews #482
1 changed files with 17 additions and 0 deletions
|
|
@ -456,6 +456,23 @@ mod sample_folder_tests {
|
||||||
assert_eq!(entries, 1, "nothing but the existing folder");
|
assert_eq!(entries, 1, "nothing but the existing folder");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// A FILE named like a sample folder blocks it as well (#384 review): the
|
||||||
|
/// check reads `exists()`, not `is_dir()`, so nothing is half-created and
|
||||||
|
/// the refusal keeps its code instead of a raw "File exists" from
|
||||||
|
/// `create_dir`.
|
||||||
|
#[test]
|
||||||
|
fn refuses_a_file_named_like_a_sample_folder_and_writes_nothing() {
|
||||||
|
let dir = sandbox("file-tangerine");
|
||||||
|
fs::write(dir.join(SAMPLE_TANGERINE_FOLDER), "").unwrap();
|
||||||
|
let result = create_sample_import_folders(as_arg(&dir), "2026-09-25".to_string());
|
||||||
|
let desjardins_created = dir.join(SAMPLE_DESJARDINS_FOLDER).exists();
|
||||||
|
let entries = fs::read_dir(&dir).unwrap().count();
|
||||||
|
cleanup(&dir);
|
||||||
|
assert_eq!(result.unwrap_err(), "sample_folder_exists:Exemple Tangerine");
|
||||||
|
assert!(!desjardins_created, "Exemple Desjardins must not be created");
|
||||||
|
assert_eq!(entries, 1, "nothing but the existing file");
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn writes_both_folders_for_the_two_previous_months() {
|
fn writes_both_folders_for_the_two_previous_months() {
|
||||||
let dir = sandbox("success");
|
let dir = sandbox("success");
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue