federation-api: Fix unstable-pre-spec tests

This commit is contained in:
Jonas Platte 2022-03-26 09:36:58 +01:00
parent 8f054ba39c
commit bf6687c92d
No known key found for this signature in database
GPG Key ID: BBA95679259D342F

View File

@ -70,6 +70,7 @@ where
#[cfg(not(feature = "unstable-pre-spec"))] #[cfg(not(feature = "unstable-pre-spec"))]
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use matches::assert_matches;
use serde_json::{json, to_value as to_json_value}; use serde_json::{json, to_value as to_json_value};
use super::{deserialize, serialize}; use super::{deserialize, serialize};
@ -88,8 +89,8 @@ mod tests {
let RoomState { origin, auth_chain, state } = deserialize(response).unwrap(); let RoomState { origin, auth_chain, state } = deserialize(response).unwrap();
assert_eq!(origin, "example.com"); assert_eq!(origin, "example.com");
assert_eq!(auth_chain, vec![]); assert_matches!(auth_chain.as_slice(), []);
assert_eq!(state, vec![]); assert_matches!(state.as_slice(), []);
} }
#[test] #[test]
@ -143,7 +144,7 @@ mod tests {
let json = json!([200, { "origin": "", "auth_chain": [], "state": [] }, 200]); let json = json!([200, { "origin": "", "auth_chain": [], "state": [] }, 200]);
let RoomState { origin, auth_chain, state } = deserialize(json).unwrap(); let RoomState { origin, auth_chain, state } = deserialize(json).unwrap();
assert_eq!(origin, ""); assert_eq!(origin, "");
assert_eq!(auth_chain, vec![]); assert_matches!(auth_chain.as_slice(), []);
assert_eq!(state, vec![]); assert_matches!(state.as_slice(), []);
} }
} }