automation_rs/google-home/src/request/sync.rs
2023-08-18 03:07:16 +02:00

31 lines
673 B
Rust

#[cfg(test)]
mod tests {
use crate::request::{Intent, Request};
#[test]
fn deserialize() {
let json = r#"{
"requestId": "ff36a3cc-ec34-11e6-b1a0-64510650abcf",
"inputs": [
{
"intent": "action.devices.SYNC"
}
]
}"#;
let req: Request = serde_json::from_str(json).unwrap();
println!("{:?}", req);
assert_eq!(
req.request_id,
"ff36a3cc-ec34-11e6-b1a0-64510650abcf".to_string()
);
assert_eq!(req.inputs.len(), 1);
match req.inputs[0] {
Intent::Sync => {}
_ => panic!("Expected Sync intent"),
}
}
}