added tests, use specific CI
This commit is contained in:
@@ -30,3 +30,69 @@ pub async fn sessions_poll_now(
|
||||
) -> Result<Vec<SessionInfo>, String> {
|
||||
poller.0.poll_now().await
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_polling_hint_parsing() {
|
||||
// Test valid hints
|
||||
assert_eq!(
|
||||
match "cast_active" {
|
||||
"cast_active" => Some(PollingHint::CastActive),
|
||||
"cast_discovery" => Some(PollingHint::CastDiscovery),
|
||||
"normal" => Some(PollingHint::Normal),
|
||||
_ => None,
|
||||
},
|
||||
Some(PollingHint::CastActive)
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
match "cast_discovery" {
|
||||
"cast_active" => Some(PollingHint::CastActive),
|
||||
"cast_discovery" => Some(PollingHint::CastDiscovery),
|
||||
"normal" => Some(PollingHint::Normal),
|
||||
_ => None,
|
||||
},
|
||||
Some(PollingHint::CastDiscovery)
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
match "normal" {
|
||||
"cast_active" => Some(PollingHint::CastActive),
|
||||
"cast_discovery" => Some(PollingHint::CastDiscovery),
|
||||
"normal" => Some(PollingHint::Normal),
|
||||
_ => None,
|
||||
},
|
||||
Some(PollingHint::Normal)
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_invalid_polling_hint() {
|
||||
// Test invalid hint
|
||||
let result = match "invalid" {
|
||||
"cast_active" => Ok(PollingHint::CastActive),
|
||||
"cast_discovery" => Ok(PollingHint::CastDiscovery),
|
||||
"normal" => Ok(PollingHint::Normal),
|
||||
_ => Err("Invalid polling hint"),
|
||||
};
|
||||
|
||||
assert!(result.is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_session_poller_wrapper_structure() {
|
||||
// Test that wrapper type structure is correct
|
||||
assert_eq!(std::mem::size_of::<SessionPollerWrapper>() > 0, true);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_polling_hints_exist() {
|
||||
// Verify polling hint variants exist
|
||||
let _ = PollingHint::CastActive;
|
||||
let _ = PollingHint::CastDiscovery;
|
||||
let _ = PollingHint::Normal;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user