Add some tests for auto create albums
This commit is contained in:
		
							parent
							
								
									aedbcb5f7d
								
							
						
					
					
						commit
						1593a1b712
					
				
					 1 changed files with 42 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -116,3 +116,45 @@ fn extract_album_names(folder_path: PathBuf, separator: String) -> Vec<String> {
 | 
			
		|||
 | 
			
		||||
    components
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#[cfg(test)]
 | 
			
		||||
mod tests {
 | 
			
		||||
    use super::*;
 | 
			
		||||
 | 
			
		||||
    #[test]
 | 
			
		||||
    fn extract_album_names_root() {
 | 
			
		||||
        let folder_path = PathBuf::new();
 | 
			
		||||
        let separator = String::from("//");
 | 
			
		||||
 | 
			
		||||
        let names = extract_album_names(folder_path, separator);
 | 
			
		||||
 | 
			
		||||
        assert_eq!(names, vec![] as Vec<String>);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    #[test]
 | 
			
		||||
    fn extract_album_names_first_level() {
 | 
			
		||||
        let folder_path = PathBuf::from("My holiday photos");
 | 
			
		||||
        let separator = String::from("//");
 | 
			
		||||
 | 
			
		||||
        let names = extract_album_names(folder_path, separator);
 | 
			
		||||
 | 
			
		||||
        assert_eq!(names, vec!["My holiday photos"]);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    #[test]
 | 
			
		||||
    fn extract_album_names_third_level() {
 | 
			
		||||
        let folder_path = PathBuf::from("My holiday photos/Europe/Toulouse");
 | 
			
		||||
        let separator = String::from("//");
 | 
			
		||||
 | 
			
		||||
        let names = extract_album_names(folder_path, separator);
 | 
			
		||||
 | 
			
		||||
        assert_eq!(
 | 
			
		||||
            names,
 | 
			
		||||
            vec![
 | 
			
		||||
                "My holiday photos",
 | 
			
		||||
                "My holiday photos//Europe",
 | 
			
		||||
                "My holiday photos//Europe//Toulouse",
 | 
			
		||||
            ]
 | 
			
		||||
        );
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue