diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 881b5010df..1c6e6a8981 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,6 +18,9 @@ concurrency: env: CARGO_TERM_COLOR: always + # Insta.rs is run directly via cargo test. We don't want insta.rs to create new snapshots files. + # Just want it to run the tests (option `no` instead of `auto`). + INSTA_UPDATE: no jobs: xtask: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 82a802cffe..6a7385e431 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -30,6 +30,33 @@ integration tests that need a running synapse instance. These tests reside in synapse for testing purposes. +### Snapshot Testing + +You can add/review snapshot tests using [insta.rs](https://insta.rs) + +Every new struct/enum that derives `Serialize` `Deserialise` should have a snapshot test for it. +Any code change that breaks serialisation will then break a test, the author will then have to decide +how to handle migration and test it if needed. + + +And for an improved review experience it's recommended (but not necessary) to install the cargo-insta tool: + +Unix: +``` +curl -LsSf https://insta.rs/install.sh | sh +``` + +Windows: +``` +powershell -c "irm https://insta.rs/install.ps1 | iex" +``` + +Usual flow is to first run the test, then review them. +``` +cargo insta test +cargo insta review +``` + ## Pull requests Ideally, a PR should have a *proper title*, with *atomic logical commits*, and diff --git a/Cargo.lock b/Cargo.lock index f4f968755e..f8d57bef3a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2595,6 +2595,19 @@ dependencies = [ "generic-array", ] +[[package]] +name = "insta" +version = "1.41.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e9ffc4d4892617c50a928c52b2961cb5174b6fc6ebf252b2fac9d21955c48b8" +dependencies = [ + "console", + "lazy_static", + "linked-hash-map", + "serde", + "similar", +] + [[package]] name = "instant" version = "0.1.13" @@ -2789,6 +2802,12 @@ dependencies = [ "vcpkg", ] +[[package]] +name = "linked-hash-map" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" + [[package]] name = "linux-raw-sys" version = "0.4.14" @@ -3170,6 +3189,7 @@ dependencies = [ "getrandom", "gloo-timers", "imbl", + "insta", "js-sys", "matrix-sdk-test-macros", "proptest", diff --git a/Cargo.toml b/Cargo.toml index 5882bd8bd7..a1aa363abd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -46,6 +46,7 @@ hmac = "0.12.1" http = "1.1.0" imbl = "3.0.0" indexmap = "2.6.0" +insta = { version = "1.41.1", features = ["json"] } itertools = "0.13.0" js-sys = "0.3.69" mime = "0.3.17" @@ -124,6 +125,9 @@ debug = 0 # for the extra time of optimizing it for a clean build of matrix-sdk-ffi. quote = { opt-level = 2 } sha2 = { opt-level = 2 } +# faster runs for insta.rs snapshot testing +insta.opt-level = 3 +similar.opt-level = 3 # Custom profile with full debugging info, use `--profile dbg` to select [profile.dbg] diff --git a/crates/matrix-sdk-common/Cargo.toml b/crates/matrix-sdk-common/Cargo.toml index 2aef55b7ef..6b7fdb0eb9 100644 --- a/crates/matrix-sdk-common/Cargo.toml +++ b/crates/matrix-sdk-common/Cargo.toml @@ -46,6 +46,7 @@ assert_matches = { workspace = true } proptest = { workspace = true } matrix-sdk-test-macros = { path = "../../testing/matrix-sdk-test-macros" } wasm-bindgen-test = { workspace = true } +insta = { workspace = true } [target.'cfg(not(target_arch = "wasm32"))'.dependencies] # Enable the test macro. diff --git a/crates/matrix-sdk-common/src/deserialized_responses.rs b/crates/matrix-sdk-common/src/deserialized_responses.rs index e9fb73f94f..0833cf3f4e 100644 --- a/crates/matrix-sdk-common/src/deserialized_responses.rs +++ b/crates/matrix-sdk-common/src/deserialized_responses.rs @@ -909,21 +909,22 @@ mod tests { use std::collections::BTreeMap; use assert_matches::assert_matches; + use insta::{assert_json_snapshot, with_settings}; use ruma::{ - event_id, + device_id, event_id, events::{room::message::RoomMessageEventContent, AnySyncTimelineEvent}, serde::Raw, - user_id, + user_id, DeviceKeyAlgorithm, }; use serde::Deserialize; use serde_json::json; use super::{ - AlgorithmInfo, DecryptedRoomEvent, EncryptionInfo, SyncTimelineEvent, TimelineEvent, - TimelineEventKind, UnableToDecryptInfo, UnableToDecryptReason, UnsignedDecryptionResult, - UnsignedEventLocation, VerificationState, WithheldCode, + AlgorithmInfo, DecryptedRoomEvent, DeviceLinkProblem, EncryptionInfo, ShieldState, + ShieldStateCode, SyncTimelineEvent, TimelineEvent, TimelineEventKind, UnableToDecryptInfo, + UnableToDecryptReason, UnsignedDecryptionResult, UnsignedEventLocation, VerificationLevel, + VerificationState, WithheldCode, }; - use crate::deserialized_responses::{DeviceLinkProblem, ShieldStateCode, VerificationLevel}; fn example_event() -> serde_json::Value { json!({ @@ -1317,4 +1318,129 @@ mod tests { let reason = UnableToDecryptReason::UnknownMegolmMessageIndex; assert!(reason.is_missing_room_key()); } + + #[test] + fn snapshot_test_verification_level() { + assert_json_snapshot!(VerificationLevel::VerificationViolation); + assert_json_snapshot!(VerificationLevel::UnsignedDevice); + assert_json_snapshot!(VerificationLevel::None(DeviceLinkProblem::InsecureSource)); + assert_json_snapshot!(VerificationLevel::None(DeviceLinkProblem::MissingDevice)); + assert_json_snapshot!(VerificationLevel::UnverifiedIdentity); + } + + #[test] + fn snapshot_test_verification_states() { + assert_json_snapshot!(VerificationState::Unverified(VerificationLevel::UnsignedDevice)); + assert_json_snapshot!(VerificationState::Unverified( + VerificationLevel::VerificationViolation + )); + assert_json_snapshot!(VerificationState::Unverified(VerificationLevel::None( + DeviceLinkProblem::InsecureSource, + ))); + assert_json_snapshot!(VerificationState::Unverified(VerificationLevel::None( + DeviceLinkProblem::MissingDevice, + ))); + assert_json_snapshot!(VerificationState::Verified); + } + + #[test] + fn snapshot_test_shield_states() { + assert_json_snapshot!(ShieldState::None); + assert_json_snapshot!(ShieldState::Red { + code: ShieldStateCode::UnverifiedIdentity, + message: "a message" + }); + assert_json_snapshot!(ShieldState::Grey { + code: ShieldStateCode::AuthenticityNotGuaranteed, + message: "authenticity of this message cannot be guaranteed", + }); + } + + #[test] + fn snapshot_test_shield_codes() { + assert_json_snapshot!(ShieldStateCode::AuthenticityNotGuaranteed); + assert_json_snapshot!(ShieldStateCode::UnknownDevice); + assert_json_snapshot!(ShieldStateCode::UnsignedDevice); + assert_json_snapshot!(ShieldStateCode::UnverifiedIdentity); + assert_json_snapshot!(ShieldStateCode::SentInClear); + assert_json_snapshot!(ShieldStateCode::VerificationViolation); + } + + #[test] + fn snapshot_test_algorithm_info() { + let mut map = BTreeMap::new(); + map.insert(DeviceKeyAlgorithm::Curve25519, "claimedclaimedcurve25519".to_owned()); + map.insert(DeviceKeyAlgorithm::Ed25519, "claimedclaimeded25519".to_owned()); + let info = AlgorithmInfo::MegolmV1AesSha2 { + curve25519_key: "curvecurvecurve".into(), + sender_claimed_keys: BTreeMap::from([ + (DeviceKeyAlgorithm::Curve25519, "claimedclaimedcurve25519".to_owned()), + (DeviceKeyAlgorithm::Ed25519, "claimedclaimeded25519".to_owned()), + ]), + }; + + assert_json_snapshot!(info) + } + + #[test] + fn snapshot_test_encryption_info() { + let info = EncryptionInfo { + sender: user_id!("@alice:localhost").to_owned(), + sender_device: Some(device_id!("ABCDEFGH").to_owned()), + algorithm_info: AlgorithmInfo::MegolmV1AesSha2 { + curve25519_key: "curvecurvecurve".into(), + sender_claimed_keys: Default::default(), + }, + verification_state: VerificationState::Verified, + }; + + with_settings!({sort_maps =>true}, { + assert_json_snapshot!(info) + }) + } + + #[test] + fn snapshot_test_sync_timeline_event() { + let room_event = SyncTimelineEvent { + kind: TimelineEventKind::Decrypted(DecryptedRoomEvent { + event: Raw::new(&example_event()).unwrap().cast(), + encryption_info: EncryptionInfo { + sender: user_id!("@sender:example.com").to_owned(), + sender_device: Some(device_id!("ABCDEFGHIJ").to_owned()), + algorithm_info: AlgorithmInfo::MegolmV1AesSha2 { + curve25519_key: "xxx".to_owned(), + sender_claimed_keys: BTreeMap::from([ + ( + DeviceKeyAlgorithm::Ed25519, + "I3YsPwqMZQXHkSQbjFNEs7b529uac2xBpI83eN3LUXo".to_owned(), + ), + ( + DeviceKeyAlgorithm::Curve25519, + "qzdW3F5IMPFl0HQgz5w/L5Oi/npKUFn8Um84acIHfPY".to_owned(), + ), + ]), + }, + verification_state: VerificationState::Verified, + }, + unsigned_encryption_info: Some(BTreeMap::from([( + UnsignedEventLocation::RelationsThreadLatestEvent, + UnsignedDecryptionResult::UnableToDecrypt(UnableToDecryptInfo { + session_id: Some("xyz".to_owned()), + reason: UnableToDecryptReason::MissingMegolmSession { + withheld_code: Some(WithheldCode::Unverified), + }, + }), + )])), + }), + push_actions: Default::default(), + }; + + with_settings!({sort_maps =>true}, { + // We use directly the serde_json formatter here, because of a bug in insta + // not serializing custom BTreeMap key enum https://github.com/mitsuhiko/insta/issues/689 + assert_json_snapshot! { + serde_json::to_value(&room_event).unwrap(), + } + }); + } } diff --git a/crates/matrix-sdk-common/src/snapshots/matrix_sdk_common__deserialized_responses__tests__snapshot_test_algorithm_info.snap b/crates/matrix-sdk-common/src/snapshots/matrix_sdk_common__deserialized_responses__tests__snapshot_test_algorithm_info.snap new file mode 100644 index 0000000000..94277ee0de --- /dev/null +++ b/crates/matrix-sdk-common/src/snapshots/matrix_sdk_common__deserialized_responses__tests__snapshot_test_algorithm_info.snap @@ -0,0 +1,13 @@ +--- +source: crates/matrix-sdk-common/src/deserialized_responses.rs +expression: info +--- +{ + "MegolmV1AesSha2": { + "curve25519_key": "curvecurvecurve", + "sender_claimed_keys": { + "ed25519": "claimedclaimeded25519", + "curve25519": "claimedclaimedcurve25519" + } + } +} diff --git a/crates/matrix-sdk-common/src/snapshots/matrix_sdk_common__deserialized_responses__tests__snapshot_test_encryption_info.snap b/crates/matrix-sdk-common/src/snapshots/matrix_sdk_common__deserialized_responses__tests__snapshot_test_encryption_info.snap new file mode 100644 index 0000000000..96e5c2b276 --- /dev/null +++ b/crates/matrix-sdk-common/src/snapshots/matrix_sdk_common__deserialized_responses__tests__snapshot_test_encryption_info.snap @@ -0,0 +1,15 @@ +--- +source: crates/matrix-sdk-common/src/deserialized_responses.rs +expression: info +--- +{ + "sender": "@alice:localhost", + "sender_device": "ABCDEFGH", + "algorithm_info": { + "MegolmV1AesSha2": { + "curve25519_key": "curvecurvecurve", + "sender_claimed_keys": {} + } + }, + "verification_state": "Verified" +} diff --git a/crates/matrix-sdk-common/src/snapshots/matrix_sdk_common__deserialized_responses__tests__snapshot_test_shield_codes-2.snap b/crates/matrix-sdk-common/src/snapshots/matrix_sdk_common__deserialized_responses__tests__snapshot_test_shield_codes-2.snap new file mode 100644 index 0000000000..9b4668eadc --- /dev/null +++ b/crates/matrix-sdk-common/src/snapshots/matrix_sdk_common__deserialized_responses__tests__snapshot_test_shield_codes-2.snap @@ -0,0 +1,5 @@ +--- +source: crates/matrix-sdk-common/src/deserialized_responses.rs +expression: "serde_json::to_value(&code).unwrap()" +--- +"UnknownDevice" diff --git a/crates/matrix-sdk-common/src/snapshots/matrix_sdk_common__deserialized_responses__tests__snapshot_test_shield_codes-3.snap b/crates/matrix-sdk-common/src/snapshots/matrix_sdk_common__deserialized_responses__tests__snapshot_test_shield_codes-3.snap new file mode 100644 index 0000000000..d9719968dd --- /dev/null +++ b/crates/matrix-sdk-common/src/snapshots/matrix_sdk_common__deserialized_responses__tests__snapshot_test_shield_codes-3.snap @@ -0,0 +1,5 @@ +--- +source: crates/matrix-sdk-common/src/deserialized_responses.rs +expression: "serde_json::to_value(&code).unwrap()" +--- +"UnsignedDevice" diff --git a/crates/matrix-sdk-common/src/snapshots/matrix_sdk_common__deserialized_responses__tests__snapshot_test_shield_codes-4.snap b/crates/matrix-sdk-common/src/snapshots/matrix_sdk_common__deserialized_responses__tests__snapshot_test_shield_codes-4.snap new file mode 100644 index 0000000000..2962f08e5e --- /dev/null +++ b/crates/matrix-sdk-common/src/snapshots/matrix_sdk_common__deserialized_responses__tests__snapshot_test_shield_codes-4.snap @@ -0,0 +1,5 @@ +--- +source: crates/matrix-sdk-common/src/deserialized_responses.rs +expression: "serde_json::to_value(&code).unwrap()" +--- +"UnverifiedIdentity" diff --git a/crates/matrix-sdk-common/src/snapshots/matrix_sdk_common__deserialized_responses__tests__snapshot_test_shield_codes-5.snap b/crates/matrix-sdk-common/src/snapshots/matrix_sdk_common__deserialized_responses__tests__snapshot_test_shield_codes-5.snap new file mode 100644 index 0000000000..f547dd10e9 --- /dev/null +++ b/crates/matrix-sdk-common/src/snapshots/matrix_sdk_common__deserialized_responses__tests__snapshot_test_shield_codes-5.snap @@ -0,0 +1,5 @@ +--- +source: crates/matrix-sdk-common/src/deserialized_responses.rs +expression: "serde_json::to_value(&code).unwrap()" +--- +"SentInClear" diff --git a/crates/matrix-sdk-common/src/snapshots/matrix_sdk_common__deserialized_responses__tests__snapshot_test_shield_codes-6.snap b/crates/matrix-sdk-common/src/snapshots/matrix_sdk_common__deserialized_responses__tests__snapshot_test_shield_codes-6.snap new file mode 100644 index 0000000000..fddf47c7d4 --- /dev/null +++ b/crates/matrix-sdk-common/src/snapshots/matrix_sdk_common__deserialized_responses__tests__snapshot_test_shield_codes-6.snap @@ -0,0 +1,5 @@ +--- +source: crates/matrix-sdk-common/src/deserialized_responses.rs +expression: "serde_json::to_value(&code).unwrap()" +--- +"VerificationViolation" diff --git a/crates/matrix-sdk-common/src/snapshots/matrix_sdk_common__deserialized_responses__tests__snapshot_test_shield_codes.snap b/crates/matrix-sdk-common/src/snapshots/matrix_sdk_common__deserialized_responses__tests__snapshot_test_shield_codes.snap new file mode 100644 index 0000000000..ad123c7c7b --- /dev/null +++ b/crates/matrix-sdk-common/src/snapshots/matrix_sdk_common__deserialized_responses__tests__snapshot_test_shield_codes.snap @@ -0,0 +1,5 @@ +--- +source: crates/matrix-sdk-common/src/deserialized_responses.rs +expression: "serde_json::to_value(&code).unwrap()" +--- +"AuthenticityNotGuaranteed" diff --git a/crates/matrix-sdk-common/src/snapshots/matrix_sdk_common__deserialized_responses__tests__snapshot_test_shield_states-2.snap b/crates/matrix-sdk-common/src/snapshots/matrix_sdk_common__deserialized_responses__tests__snapshot_test_shield_states-2.snap new file mode 100644 index 0000000000..e399c209db --- /dev/null +++ b/crates/matrix-sdk-common/src/snapshots/matrix_sdk_common__deserialized_responses__tests__snapshot_test_shield_states-2.snap @@ -0,0 +1,10 @@ +--- +source: crates/matrix-sdk-common/src/deserialized_responses.rs +expression: "serde_json::to_value(&state).unwrap()" +--- +{ + "Red": { + "code": "UnverifiedIdentity", + "message": "a message" + } +} diff --git a/crates/matrix-sdk-common/src/snapshots/matrix_sdk_common__deserialized_responses__tests__snapshot_test_shield_states-3.snap b/crates/matrix-sdk-common/src/snapshots/matrix_sdk_common__deserialized_responses__tests__snapshot_test_shield_states-3.snap new file mode 100644 index 0000000000..e3f80a0526 --- /dev/null +++ b/crates/matrix-sdk-common/src/snapshots/matrix_sdk_common__deserialized_responses__tests__snapshot_test_shield_states-3.snap @@ -0,0 +1,10 @@ +--- +source: crates/matrix-sdk-common/src/deserialized_responses.rs +expression: "serde_json::to_value(&state).unwrap()" +--- +{ + "Grey": { + "code": "AuthenticityNotGuaranteed", + "message": "authenticity of this message cannot be guaranteed" + } +} diff --git a/crates/matrix-sdk-common/src/snapshots/matrix_sdk_common__deserialized_responses__tests__snapshot_test_shield_states.snap b/crates/matrix-sdk-common/src/snapshots/matrix_sdk_common__deserialized_responses__tests__snapshot_test_shield_states.snap new file mode 100644 index 0000000000..24a9120e3a --- /dev/null +++ b/crates/matrix-sdk-common/src/snapshots/matrix_sdk_common__deserialized_responses__tests__snapshot_test_shield_states.snap @@ -0,0 +1,5 @@ +--- +source: crates/matrix-sdk-common/src/deserialized_responses.rs +expression: "serde_json::to_value(&state).unwrap()" +--- +"None" diff --git a/crates/matrix-sdk-common/src/snapshots/matrix_sdk_common__deserialized_responses__tests__snapshot_test_sync_timeline_event.snap b/crates/matrix-sdk-common/src/snapshots/matrix_sdk_common__deserialized_responses__tests__snapshot_test_sync_timeline_event.snap new file mode 100644 index 0000000000..f40882141c --- /dev/null +++ b/crates/matrix-sdk-common/src/snapshots/matrix_sdk_common__deserialized_responses__tests__snapshot_test_sync_timeline_event.snap @@ -0,0 +1,47 @@ +--- +source: crates/matrix-sdk-common/src/deserialized_responses.rs +expression: "serde_json::to_value(&room_event).unwrap()" +--- +{ + "kind": { + "Decrypted": { + "encryption_info": { + "algorithm_info": { + "MegolmV1AesSha2": { + "curve25519_key": "xxx", + "sender_claimed_keys": { + "curve25519": "qzdW3F5IMPFl0HQgz5w/L5Oi/npKUFn8Um84acIHfPY", + "ed25519": "I3YsPwqMZQXHkSQbjFNEs7b529uac2xBpI83eN3LUXo" + } + } + }, + "sender": "@sender:example.com", + "sender_device": "ABCDEFGHIJ", + "verification_state": "Verified" + }, + "event": { + "content": { + "body": "secret", + "msgtype": "m.text" + }, + "event_id": "$xxxxx:example.org", + "origin_server_ts": 2189, + "room_id": "!someroom:example.com", + "sender": "@carl:example.com", + "type": "m.room.message" + }, + "unsigned_encryption_info": { + "RelationsThreadLatestEvent": { + "UnableToDecrypt": { + "reason": { + "MissingMegolmSession": { + "withheld_code": "m.unverified" + } + }, + "session_id": "xyz" + } + } + } + } + } +} diff --git a/crates/matrix-sdk-common/src/snapshots/matrix_sdk_common__deserialized_responses__tests__snapshot_test_verification_level-2.snap b/crates/matrix-sdk-common/src/snapshots/matrix_sdk_common__deserialized_responses__tests__snapshot_test_verification_level-2.snap new file mode 100644 index 0000000000..fc816009b1 --- /dev/null +++ b/crates/matrix-sdk-common/src/snapshots/matrix_sdk_common__deserialized_responses__tests__snapshot_test_verification_level-2.snap @@ -0,0 +1,5 @@ +--- +source: crates/matrix-sdk-common/src/deserialized_responses.rs +expression: "serde_json::to_value(&level).unwrap()" +--- +"UnsignedDevice" diff --git a/crates/matrix-sdk-common/src/snapshots/matrix_sdk_common__deserialized_responses__tests__snapshot_test_verification_level-3.snap b/crates/matrix-sdk-common/src/snapshots/matrix_sdk_common__deserialized_responses__tests__snapshot_test_verification_level-3.snap new file mode 100644 index 0000000000..2d27ef8c55 --- /dev/null +++ b/crates/matrix-sdk-common/src/snapshots/matrix_sdk_common__deserialized_responses__tests__snapshot_test_verification_level-3.snap @@ -0,0 +1,7 @@ +--- +source: crates/matrix-sdk-common/src/deserialized_responses.rs +expression: "serde_json::to_value(&level).unwrap()" +--- +{ + "None": "InsecureSource" +} diff --git a/crates/matrix-sdk-common/src/snapshots/matrix_sdk_common__deserialized_responses__tests__snapshot_test_verification_level-4.snap b/crates/matrix-sdk-common/src/snapshots/matrix_sdk_common__deserialized_responses__tests__snapshot_test_verification_level-4.snap new file mode 100644 index 0000000000..180ef3de9c --- /dev/null +++ b/crates/matrix-sdk-common/src/snapshots/matrix_sdk_common__deserialized_responses__tests__snapshot_test_verification_level-4.snap @@ -0,0 +1,7 @@ +--- +source: crates/matrix-sdk-common/src/deserialized_responses.rs +expression: "serde_json::to_value(&level).unwrap()" +--- +{ + "None": "MissingDevice" +} diff --git a/crates/matrix-sdk-common/src/snapshots/matrix_sdk_common__deserialized_responses__tests__snapshot_test_verification_level-5.snap b/crates/matrix-sdk-common/src/snapshots/matrix_sdk_common__deserialized_responses__tests__snapshot_test_verification_level-5.snap new file mode 100644 index 0000000000..540df71e46 --- /dev/null +++ b/crates/matrix-sdk-common/src/snapshots/matrix_sdk_common__deserialized_responses__tests__snapshot_test_verification_level-5.snap @@ -0,0 +1,5 @@ +--- +source: crates/matrix-sdk-common/src/deserialized_responses.rs +expression: "serde_json::to_value(&level).unwrap()" +--- +"UnverifiedIdentity" diff --git a/crates/matrix-sdk-common/src/snapshots/matrix_sdk_common__deserialized_responses__tests__snapshot_test_verification_level.snap b/crates/matrix-sdk-common/src/snapshots/matrix_sdk_common__deserialized_responses__tests__snapshot_test_verification_level.snap new file mode 100644 index 0000000000..e68abafa23 --- /dev/null +++ b/crates/matrix-sdk-common/src/snapshots/matrix_sdk_common__deserialized_responses__tests__snapshot_test_verification_level.snap @@ -0,0 +1,5 @@ +--- +source: crates/matrix-sdk-common/src/deserialized_responses.rs +expression: "serde_json::to_value(&level).unwrap()" +--- +"VerificationViolation" diff --git a/crates/matrix-sdk-common/src/snapshots/matrix_sdk_common__deserialized_responses__tests__snapshot_test_verification_states-2.snap b/crates/matrix-sdk-common/src/snapshots/matrix_sdk_common__deserialized_responses__tests__snapshot_test_verification_states-2.snap new file mode 100644 index 0000000000..716d8ff137 --- /dev/null +++ b/crates/matrix-sdk-common/src/snapshots/matrix_sdk_common__deserialized_responses__tests__snapshot_test_verification_states-2.snap @@ -0,0 +1,7 @@ +--- +source: crates/matrix-sdk-common/src/deserialized_responses.rs +expression: "serde_json::to_value(&state).unwrap()" +--- +{ + "Unverified": "VerificationViolation" +} diff --git a/crates/matrix-sdk-common/src/snapshots/matrix_sdk_common__deserialized_responses__tests__snapshot_test_verification_states-3.snap b/crates/matrix-sdk-common/src/snapshots/matrix_sdk_common__deserialized_responses__tests__snapshot_test_verification_states-3.snap new file mode 100644 index 0000000000..fae5d49deb --- /dev/null +++ b/crates/matrix-sdk-common/src/snapshots/matrix_sdk_common__deserialized_responses__tests__snapshot_test_verification_states-3.snap @@ -0,0 +1,9 @@ +--- +source: crates/matrix-sdk-common/src/deserialized_responses.rs +expression: "serde_json::to_value(&state).unwrap()" +--- +{ + "Unverified": { + "None": "InsecureSource" + } +} diff --git a/crates/matrix-sdk-common/src/snapshots/matrix_sdk_common__deserialized_responses__tests__snapshot_test_verification_states-4.snap b/crates/matrix-sdk-common/src/snapshots/matrix_sdk_common__deserialized_responses__tests__snapshot_test_verification_states-4.snap new file mode 100644 index 0000000000..a721a9e0a9 --- /dev/null +++ b/crates/matrix-sdk-common/src/snapshots/matrix_sdk_common__deserialized_responses__tests__snapshot_test_verification_states-4.snap @@ -0,0 +1,9 @@ +--- +source: crates/matrix-sdk-common/src/deserialized_responses.rs +expression: "serde_json::to_value(&state).unwrap()" +--- +{ + "Unverified": { + "None": "MissingDevice" + } +} diff --git a/crates/matrix-sdk-common/src/snapshots/matrix_sdk_common__deserialized_responses__tests__snapshot_test_verification_states-5.snap b/crates/matrix-sdk-common/src/snapshots/matrix_sdk_common__deserialized_responses__tests__snapshot_test_verification_states-5.snap new file mode 100644 index 0000000000..6a8559c1f7 --- /dev/null +++ b/crates/matrix-sdk-common/src/snapshots/matrix_sdk_common__deserialized_responses__tests__snapshot_test_verification_states-5.snap @@ -0,0 +1,5 @@ +--- +source: crates/matrix-sdk-common/src/deserialized_responses.rs +expression: "serde_json::to_value(&state).unwrap()" +--- +"Verified" diff --git a/crates/matrix-sdk-common/src/snapshots/matrix_sdk_common__deserialized_responses__tests__snapshot_test_verification_states.snap b/crates/matrix-sdk-common/src/snapshots/matrix_sdk_common__deserialized_responses__tests__snapshot_test_verification_states.snap new file mode 100644 index 0000000000..80c229057d --- /dev/null +++ b/crates/matrix-sdk-common/src/snapshots/matrix_sdk_common__deserialized_responses__tests__snapshot_test_verification_states.snap @@ -0,0 +1,7 @@ +--- +source: crates/matrix-sdk-common/src/deserialized_responses.rs +expression: "serde_json::to_value(&state).unwrap()" +--- +{ + "Unverified": "UnsignedDevice" +}