Skip to content

LightCraft: An open-source non-destructive photo editor written by scratch in pure Rust

test(slideshow): drop the template cache after the hand-written bad files

mahmatias54c65051919d
diff --git a/crates/engine/src/tests_slide_template.rs b/crates/engine/src/tests_slide_template.rs
index f7a899c43..9d3e9c807 100644
--- a/crates/engine/src/tests_slide_template.rs
+++ b/crates/engine/src/tests_slide_template.rs
@@ -248,6 +248,9 @@ fn bad_files_are_reported_and_skipped() {
}
std::fs::create_dir_all(folder.join("folder.json")).unwrap();
std::fs::write(folder.join("notes.txt"), b"ignored").unwrap();
+ // written by hand, not through LightCraft: the folder's time may not have moved since the
+ // save's listing (same clock tick), so the cached listing is dropped as a write would drop it
+ s.slide_templates_cache = None;
let r = run(&mut s, "slideshow.templates.list", json!({}));
let user: Vec<_> = r["templates"].as_array().unwrap().iter().filter(|t| t["builtin"] == false).collect();
assert_eq!(user.len(), 1, "only the good one: {r}");