mirror of
https://github.com/storytold/lightcraft.git
synced 2026-10-24 10:09:01 -06:00
test(slideshow): drop the template cache after the hand-written bad files
The folder's mtime may not move from the save's listing to the list that follows (same clock tick on a fast machine), so the stale cache hid the bad files and problems came back empty - deterministic on a warm build. The test drops the cache as its own wild.json case already did (and as templates_changed documents).
This commit is contained in:
@@ -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}");
|
||||
|
||||
Reference in New Issue
Block a user