Add test #41

Merged
kdeng00 merged 8 commits from add_test into master 2025-03-25 22:43:42 -04:00
9 changed files with 62 additions and 2 deletions
Showing only changes of commit f70359c04d - Show all commits
+1
View File
@@ -3,6 +3,7 @@ mod managers;
mod models;
mod parsers;
mod syncers;
mod tests;
mod utilities;
use std::env;
+1 -2
View File
@@ -207,7 +207,6 @@ mod tests {
&& action != "upload-meta")
);
let mut all_flags_found = false;
let mut found_count = 0;
let mut flags_already_read = Vec::new();
@@ -228,7 +227,7 @@ mod tests {
}
}
all_flags_found = found_count == 3;
let all_flags_found = found_count == 3;
assert_eq!(found_count, 3, "Three flags are required: -u, -p, -h");
assert!(all_flags_found, "All flags have not been found");
+1
View File
@@ -0,0 +1 @@
pub mod tests;

Before

Width:  |  Height:  |  Size: 75 KiB

After

Width:  |  Height:  |  Size: 75 KiB

+59
View File
@@ -0,0 +1,59 @@
// mod managers;
// mod tests;
// use i
// use crate::icarus_dm::managers;
// use icarus-dm;
// use managers;
mod tests {
#[cfg(test)]
fn test_song_prep_upload() {
use crate::managers;
let meta_path = String::from("tests/sample2_tracks/album.json");
if !std::path::Path::new(&meta_path).exists() {
assert!(false, "File does not exists: {:?}", meta_path);
}
match icarus_models::album::collection::parse_album(&meta_path) {
Ok(album) => {
for track in 1..3 {
let directory_path = std::path::Path::new(&meta_path);
let directory: String = directory_path.parent().unwrap().display().to_string();
// let track = 1;
let filename: String = if track < 10 {
String::from("track0")
+ &track.to_string()
+ icarus_models::constants::DEFAULTMUSICEXTENSION
} else {
String::from("track")
+ &track.to_string()
+ icarus_models::constants::DEFAULTMUSICEXTENSION
};
let disc = 1;
match managers::commit_manager::retrieve_song(
&album, track, disc, &directory, &filename,
) {
Ok(song) => match song.to_data() {
Ok(_) => {
print!("Success");
}
Err(err) => {
assert!(false, "Error: {:?}", err.to_string());
}
},
Err(err) => {
assert!(false, "Error: {:?}", err.to_string());
}
}
}
}
Err(err) => {
assert!(false, "Error: {:?}", err.to_string());
}
}
}
}