stream: deserialize with no fileidx
@@ -76,4 +76,27 @@ mod test {
}
)
}
+
+ #[test]
+ pub fn deserialize_no_fileidx() {
+ let stream_json = "{\"infoHash\":\"07a9de9750158471c3302e4e95edb1107f980fa6\",\"title\":\"test stream\"}";
+ let stream: Stream = serde_json::from_str(&stream_json).unwrap();
+ dbg!(&stream);
+ assert_eq!(
+ stream,
+ Stream {
+ title: Some("test stream".into()),
+ thumbnail: None,
+ subtitles: Default::default(),
+ behavior_hints: Default::default(),
+ source: StreamSource::Torrent {
+ info_hash: [
+ 0x07, 0xa9, 0xde, 0x97, 0x50, 0x15, 0x84, 0x71, 0xc3, 0x30, 0x2e, 0x4e,
+ 0x95, 0xed, 0xb1, 0x10, 0x7f, 0x98, 0x0f, 0xa6
+ ],
+ file_idx: None,
+ }
+ }
+ )
+ }
}
