()
| 81 | // Test song insertion |
| 82 | #[test] |
| 83 | fn test_insert_song() { |
| 84 | let db_path = get_test_db_path(); |
| 85 | let db = Database::new(db_path.clone()); |
| 86 | |
| 87 | let test_song = create_test_song("Test Song", "/path/to/test.mp3"); |
| 88 | let result = db.insert_songs(vec![test_song]).unwrap(); |
| 89 | |
| 90 | assert_eq!(result.len(), 1); |
| 91 | assert!(result[0].song._id.is_some()); |
| 92 | assert_eq!(result[0].song.title.as_ref().unwrap(), "Test Song"); |
| 93 | |
| 94 | // Test album was created |
| 95 | let album = result[0].album.clone().unwrap(); |
| 96 | assert!(album.album_id.is_some()); |
| 97 | assert_eq!(album.album_name, Some("Test Album".to_string())); |
| 98 | |
| 99 | // Test artist was created |
| 100 | let artists = result[0].artists.clone().unwrap(); |
| 101 | assert_eq!(artists.len(), 1); |
| 102 | assert!(artists[0].artist_id.is_some()); |
| 103 | assert_eq!(artists[0].artist_name, Some("Test Artist".to_string())); |
| 104 | |
| 105 | // Test genre was created |
| 106 | let genres = result[0].genre.clone().unwrap(); |
| 107 | assert_eq!(genres.len(), 1); |
| 108 | assert!(genres[0].genre_id.is_some()); |
| 109 | assert_eq!(genres[0].genre_name, Some("Test Genre".to_string())); |
| 110 | |
| 111 | cleanup(&db_path); |
| 112 | } |
| 113 | |
| 114 | // Test fetching songs by options |
| 115 | #[test] |
nothing calls this directly
no test coverage detected