fix tests

This commit is contained in:
Nick Pegg 2025-05-07 20:48:50 -07:00
parent cf8394fb2a
commit 5c1e1feb17
2 changed files with 6 additions and 9 deletions

View file

@ -67,8 +67,7 @@ impl AlbumDir {
"Loading Markdown from {}", "Loading Markdown from {}",
entry_path.with_extension("md").display() entry_path.with_extension("md").display()
); );
let contents = let contents = fs::read_to_string(entry_path.with_extension("md"))?;
fs::read_to_string(&entry_path.with_extension("md"))?;
let parser = pulldown_cmark::Parser::new(&contents); let parser = pulldown_cmark::Parser::new(&contents);
pulldown_cmark::html::push_html(&mut description, parser); pulldown_cmark::html::push_html(&mut description, parser);
} }
@ -266,7 +265,7 @@ mod tests {
let mut ad = AlbumDir { let mut ad = AlbumDir {
path: "".into(), path: "".into(),
description: "".to_string(), description: "".to_string(),
cover: Some(Image::new("foo".into(), "".to_string()).unwrap()), cover: Image::new("foo".into(), "".to_string()).unwrap(),
images: vec![ images: vec![
Image::new("foo".into(), "".to_string()).unwrap(), Image::new("foo".into(), "".to_string()).unwrap(),
Image::new("bar".into(), "".to_string()).unwrap(), Image::new("bar".into(), "".to_string()).unwrap(),
@ -277,7 +276,7 @@ mod tests {
ad.children.push(AlbumDir { ad.children.push(AlbumDir {
path: "subdir".into(), path: "subdir".into(),
description: "".to_string(), description: "".to_string(),
cover: Some(Image::new("subdir/foo".into(), "".to_string()).unwrap()), cover: Image::new("subdir/foo".into(), "".to_string()).unwrap(),
images: vec![ images: vec![
Image::new("subdir/foo".into(), "".to_string()).unwrap(), Image::new("subdir/foo".into(), "".to_string()).unwrap(),
Image::new("subdir/bar".into(), "".to_string()).unwrap(), Image::new("subdir/bar".into(), "".to_string()).unwrap(),
@ -285,9 +284,7 @@ mod tests {
children: vec![AlbumDir { children: vec![AlbumDir {
path: "subdir/deeper_subdir".into(), path: "subdir/deeper_subdir".into(),
description: "".to_string(), description: "".to_string(),
cover: Some( cover: Image::new("subdir/deeper_subdir/image.jpg".into(), "".to_string()).unwrap(),
Image::new("subdir/deeper_subdir/image.jpg".into(), "".to_string()).unwrap(),
),
images: vec![ images: vec![
Image::new("subdir/deeper_subdir/image.jpg".into(), String::new()).unwrap(), Image::new("subdir/deeper_subdir/image.jpg".into(), String::new()).unwrap(),
], ],
@ -297,7 +294,7 @@ mod tests {
// A child album with no images // A child album with no images
ad.children.push(AlbumDir { ad.children.push(AlbumDir {
description: "".to_string(), description: "".to_string(),
cover: None, cover: Image::new("blah".into(), "".to_string()).unwrap(),
path: "another_subdir".into(), path: "another_subdir".into(),
images: vec![], images: vec![],
children: vec![], children: vec![],

View file

@ -12,7 +12,7 @@ use std::path::{Path, PathBuf};
fn test_generate() { fn test_generate() {
init(); init();
let album_path = make_test_album(); let album_path = make_test_album();
let output_path = generate(&album_path.to_path_buf()).unwrap(); let output_path = generate(&album_path.to_path_buf(), false).unwrap();
check_album(output_path).unwrap(); check_album(output_path).unwrap();
} }