Skip to content

Commit f1e7894

Browse files
BillCarsonFrpoljar
authored andcommitted
fixup: insta use shorter names
1 parent ef44631 commit f1e7894

File tree

5 files changed

+34
-23
lines changed

5 files changed

+34
-23
lines changed

crates/matrix-sdk-crypto/src/machine/tests/send_encrypted_to_device.rs

Lines changed: 34 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -217,38 +217,49 @@ async fn test_processed_to_device_variants() {
217217
let processed_event = &processed[0];
218218
assert_matches!(processed_event, ProcessedToDeviceEvent::Decrypted(_));
219219

220-
assert_json_snapshot!(
221-
serde_json::from_str::<Value>(processed_event.to_raw().json().get()).unwrap(),
222-
{
223-
".keys.ed25519" => "[sender_ed25519_key]",
224-
r#"["org.matrix.msc4147.device_keys"].device_id"# => "[ABCDEFGH]",
225-
r#"["org.matrix.msc4147.device_keys"].keys"# => "++REDACTED++",
226-
r#"["org.matrix.msc4147.device_keys"].signatures"# => "++REDACTED++",
227-
".recipient_keys.ed25519" => "[recipient_sender_key]",
228-
}
229-
);
220+
insta::with_settings!({ prepend_module_to_snapshot => false }, {
221+
assert_json_snapshot!(
222+
serde_json::from_str::<Value>(processed_event.to_raw().json().get()).unwrap(),
223+
{
224+
".keys.ed25519" => "[sender_ed25519_key]",
225+
r#"["org.matrix.msc4147.device_keys"].device_id"# => "[ABCDEFGH]",
226+
r#"["org.matrix.msc4147.device_keys"].keys"# => "++REDACTED++",
227+
r#"["org.matrix.msc4147.device_keys"].signatures"# => "++REDACTED++",
228+
".recipient_keys.ed25519" => "[recipient_sender_key]",
229+
}
230+
);
231+
});
230232

231233
let processed_event = &processed[1];
232234
assert_matches!(processed_event, ProcessedToDeviceEvent::PlainText(_));
233-
assert_json_snapshot!(
234-
serde_json::from_str::<Value>(processed_event.to_raw().json().get()).unwrap(),
235-
);
235+
236+
insta::with_settings!({ prepend_module_to_snapshot => false }, {
237+
assert_json_snapshot!(
238+
serde_json::from_str::<Value>(processed_event.to_raw().json().get()).unwrap(),
239+
);
240+
});
236241

237242
let processed_event = &processed[2];
238243
assert_matches!(processed_event, ProcessedToDeviceEvent::Invalid(_));
239-
assert_json_snapshot!(
240-
serde_json::from_str::<Value>(processed_event.to_raw().json().get()).unwrap(),
241-
);
244+
245+
insta::with_settings!({ prepend_module_to_snapshot => false }, {
246+
assert_json_snapshot!(
247+
serde_json::from_str::<Value>(processed_event.to_raw().json().get()).unwrap(),
248+
);
249+
});
242250

243251
let processed_event = &processed[3];
244252
assert_matches!(processed_event, ProcessedToDeviceEvent::UnableToDecrypt(_));
245-
assert_json_snapshot!(
246-
serde_json::from_str::<Value>(processed_event.to_raw().json().get()).unwrap(),
247-
{
248-
".content.sender_key" => "[sender_ed25519_key]",
249-
".content.ciphertext" => "[++REDACTED++]",
250-
}
251-
);
253+
254+
insta::with_settings!({ prepend_module_to_snapshot => false }, {
255+
assert_json_snapshot!(
256+
serde_json::from_str::<Value>(processed_event.to_raw().json().get()).unwrap(),
257+
{
258+
".content.sender_key" => "[sender_ed25519_key]",
259+
".content.ciphertext" => "[++REDACTED++]",
260+
}
261+
);
262+
});
252263
}
253264

254265
#[async_test]

0 commit comments

Comments
 (0)