use rsp::scrobbler::Scrobbler; #[test] fn test_scrobbler_new_with_all_params() { let scrobbler = Scrobbler::new( Some("api_key".to_string()), Some("secret".to_string()), Some("session".to_string()), Some("token".to_string()), ); assert!(scrobbler.lastfm_api_key.is_some()); assert!(scrobbler.lastfm_api_secret.is_some()); assert!(scrobbler.lastfm_session_key.is_some()); assert!(scrobbler.listenbrainz_token.is_some()); } #[test] fn test_scrobbler_new_with_none() { let scrobbler = Scrobbler::new(None, None, None, None); assert!(scrobbler.lastfm_api_key.is_none()); assert!(scrobbler.lastfm_api_secret.is_none()); assert!(scrobbler.lastfm_session_key.is_none()); assert!(scrobbler.listenbrainz_token.is_none()); } #[test] fn test_scrobbler_now_playing_no_api_key() { let scrobbler = Scrobbler::new(None, None, None, None); scrobbler.now_playing("Artist", "Track", Some("Album")); } #[test] fn test_scrobbler_now_playing_with_api_key() { let scrobbler = Scrobbler::new(Some("api_key".to_string()), None, None, None); scrobbler.now_playing("Artist", "Track", Some("Album")); } #[test] fn test_scrobbler_scrobble_no_keys() { let scrobbler = Scrobbler::new(None, None, None, None); scrobbler.scrobble("Artist", "Track", Some("Album"), 1234567890); } #[test] fn test_scrobbler_scrobble_with_lastfm() { let scrobbler = Scrobbler::new(Some("api_key".to_string()), None, None, None); scrobbler.scrobble("Artist", "Track", Some("Album"), 1234567890); } #[test] fn test_scrobbler_scrobble_with_listenbrainz() { let scrobbler = Scrobbler::new(None, None, None, Some("token".to_string())); scrobbler.scrobble("Artist", "Track", Some("Album"), 1234567890); } #[test] fn test_scrobbler_scrobble_with_both() { let scrobbler = Scrobbler::new( Some("api_key".to_string()), None, None, Some("token".to_string()), ); scrobbler.scrobble("Artist", "Track", Some("Album"), 1234567890); } #[test] fn test_scrobbler_now_playing_no_album() { let scrobbler = Scrobbler::new(Some("api_key".to_string()), None, None, None); scrobbler.now_playing("Artist", "Track", None); } #[test] fn test_scrobbler_scrobble_no_album() { let scrobbler = Scrobbler::new(Some("api_key".to_string()), None, None, None); scrobbler.scrobble("Artist", "Track", None, 1234567890); }