Skip to content

Commit

Permalink
Merge branch 'main' into valere/insta_rs_snapshot_testing
Browse files Browse the repository at this point in the history
  • Loading branch information
BillCarsonFr committed Dec 18, 2024
2 parents a26f30a + bb57311 commit 172d4ab
Show file tree
Hide file tree
Showing 29 changed files with 502 additions and 86 deletions.
18 changes: 9 additions & 9 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -98,17 +98,17 @@ web-sys = "0.3.69"
wiremock = "0.6.2"
zeroize = "1.8.1"

matrix-sdk = { path = "crates/matrix-sdk", version = "0.8.0", default-features = false }
matrix-sdk-base = { path = "crates/matrix-sdk-base", version = "0.8.0" }
matrix-sdk-common = { path = "crates/matrix-sdk-common", version = "0.8.0" }
matrix-sdk-crypto = { path = "crates/matrix-sdk-crypto", version = "0.8.0" }
matrix-sdk = { path = "crates/matrix-sdk", version = "0.9.0", default-features = false }
matrix-sdk-base = { path = "crates/matrix-sdk-base", version = "0.9.0" }
matrix-sdk-common = { path = "crates/matrix-sdk-common", version = "0.9.0" }
matrix-sdk-crypto = { path = "crates/matrix-sdk-crypto", version = "0.9.0" }
matrix-sdk-ffi-macros = { path = "bindings/matrix-sdk-ffi-macros", version = "0.7.0" }
matrix-sdk-indexeddb = { path = "crates/matrix-sdk-indexeddb", version = "0.8.0", default-features = false }
matrix-sdk-qrcode = { path = "crates/matrix-sdk-qrcode", version = "0.8.0" }
matrix-sdk-sqlite = { path = "crates/matrix-sdk-sqlite", version = "0.8.0", default-features = false }
matrix-sdk-store-encryption = { path = "crates/matrix-sdk-store-encryption", version = "0.8.0" }
matrix-sdk-indexeddb = { path = "crates/matrix-sdk-indexeddb", version = "0.9.0", default-features = false }
matrix-sdk-qrcode = { path = "crates/matrix-sdk-qrcode", version = "0.9.0" }
matrix-sdk-sqlite = { path = "crates/matrix-sdk-sqlite", version = "0.9.0", default-features = false }
matrix-sdk-store-encryption = { path = "crates/matrix-sdk-store-encryption", version = "0.9.0" }
matrix-sdk-test = { path = "testing/matrix-sdk-test", version = "0.7.0" }
matrix-sdk-ui = { path = "crates/matrix-sdk-ui", version = "0.8.0", default-features = false }
matrix-sdk-ui = { path = "crates/matrix-sdk-ui", version = "0.9.0", default-features = false }

# Default release profile, select with `--release`
[profile.release]
Expand Down
2 changes: 2 additions & 0 deletions crates/matrix-sdk-base/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ All notable changes to this project will be documented in this file.

## [Unreleased] - ReleaseDate

## [0.9.0] - 2024-12-18

### Features

- Introduced support for
Expand Down
2 changes: 1 addition & 1 deletion crates/matrix-sdk-base/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ name = "matrix-sdk-base"
readme = "README.md"
repository = "https://github.com/matrix-org/matrix-rust-sdk"
rust-version = { workspace = true }
version = "0.8.0"
version = "0.9.0"

[package.metadata.docs.rs]
all-features = true
Expand Down
2 changes: 2 additions & 0 deletions crates/matrix-sdk-common/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ All notable changes to this project will be documented in this file.

## [Unreleased] - ReleaseDate

## [0.9.0] - 2024-12-18

### Bug Fixes

- Change the behavior of `LinkedChunk::new_with_update_history()` to emit an
Expand Down
2 changes: 1 addition & 1 deletion crates/matrix-sdk-common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ name = "matrix-sdk-common"
readme = "README.md"
repository = "https://github.com/matrix-org/matrix-rust-sdk"
rust-version = { workspace = true }
version = "0.8.0"
version = "0.9.0"

[package.metadata.docs.rs]
default-target = "x86_64-unknown-linux-gnu"
Expand Down
70 changes: 70 additions & 0 deletions crates/matrix-sdk-common/src/deserialized_responses.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ pub enum VerificationLevel {

/// The message was sent by a user identity we have not verified, but the
/// user was previously verified.
#[serde(alias = "PreviouslyVerified")]
VerificationViolation,

/// The message was sent by a device not linked to (signed by) any user
Expand Down Expand Up @@ -262,6 +263,7 @@ pub enum ShieldStateCode {
/// An unencrypted event in an encrypted room.
SentInClear,
/// The sender was previously verified but changed their identity.
#[serde(alias = "PreviouslyVerified")]
VerificationViolation,
}

Expand Down Expand Up @@ -997,6 +999,74 @@ mod tests {
);
}

#[test]
fn test_verification_level_deserializes() {
// Given a JSON VerificationLevel
#[derive(Deserialize)]
struct Container {
verification_level: VerificationLevel,
}
let container = json!({ "verification_level": "VerificationViolation" });

// When we deserialize it
let deserialized: Container = serde_json::from_value(container)
.expect("We can deserialize the old PreviouslyVerified value");

// Then it is populated correctly
assert_eq!(deserialized.verification_level, VerificationLevel::VerificationViolation);
}

#[test]
fn test_verification_level_deserializes_from_old_previously_verified_value() {
// Given a JSON VerificationLevel with the old value PreviouslyVerified
#[derive(Deserialize)]
struct Container {
verification_level: VerificationLevel,
}
let container = json!({ "verification_level": "PreviouslyVerified" });

// When we deserialize it
let deserialized: Container = serde_json::from_value(container)
.expect("We can deserialize the old PreviouslyVerified value");

// Then it is migrated to the new value
assert_eq!(deserialized.verification_level, VerificationLevel::VerificationViolation);
}

#[test]
fn test_shield_state_code_deserializes() {
// Given a JSON ShieldStateCode with value VerificationViolation
#[derive(Deserialize)]
struct Container {
shield_state_code: ShieldStateCode,
}
let container = json!({ "shield_state_code": "VerificationViolation" });

// When we deserialize it
let deserialized: Container = serde_json::from_value(container)
.expect("We can deserialize the old PreviouslyVerified value");

// Then it is populated correctly
assert_eq!(deserialized.shield_state_code, ShieldStateCode::VerificationViolation);
}

#[test]
fn test_shield_state_code_deserializes_from_old_previously_verified_value() {
// Given a JSON ShieldStateCode with the old value PreviouslyVerified
#[derive(Deserialize)]
struct Container {
shield_state_code: ShieldStateCode,
}
let container = json!({ "shield_state_code": "PreviouslyVerified" });

// When we deserialize it
let deserialized: Container = serde_json::from_value(container)
.expect("We can deserialize the old PreviouslyVerified value");

// Then it is migrated to the new value
assert_eq!(deserialized.shield_state_code, ShieldStateCode::VerificationViolation);
}

#[test]
fn sync_timeline_event_serialisation() {
let room_event = SyncTimelineEvent {
Expand Down
Loading

0 comments on commit 172d4ab

Please sign in to comment.