mirror of
https://github.com/NotAShelf/mpvrc.git
synced 2026-04-15 15:33:47 +00:00
commands: add basic tests
This commit is contained in:
parent
702de2aeee
commit
e31062d0ed
1 changed files with 30 additions and 0 deletions
|
|
@ -215,3 +215,33 @@ impl Commands {
|
|||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_add_files_empty_list() {
|
||||
let result = Commands::add_files(&[]).await;
|
||||
assert!(result.is_err());
|
||||
if let Err(MrcError::InvalidInput(msg)) = result {
|
||||
assert_eq!(msg, "No files provided to add to the playlist");
|
||||
} else {
|
||||
panic!("Expected InvalidInput error");
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_replace_playlist_empty() {
|
||||
let result = Commands::replace_playlist(&[]).await;
|
||||
// Should succeed (no-op) with empty list
|
||||
assert!(result.is_ok());
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_get_properties_empty() {
|
||||
let result = Commands::get_properties(&[]).await;
|
||||
// Should succeed (no-op) with empty list
|
||||
assert!(result.is_ok());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue