Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
toger5 committed Jul 4, 2024
1 parent 2c25152 commit 0506014
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
1 change: 1 addition & 0 deletions crates/matrix-sdk/src/widget/machine/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ mod api_versions;
mod capabilities;
mod error;
mod openid;
mod send_event;

const WIDGET_ID: &str = "test-widget";

Expand Down
30 changes: 30 additions & 0 deletions crates/matrix-sdk/src/widget/machine/tests/send_event.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
use ruma::owned_room_id;

use crate::widget::machine::{IncomingMessage, WidgetMachine};

use super::WIDGET_ID;

#[test]
fn process_send_event() {
let (mut machine, _) = WidgetMachine::new(
WIDGET_ID.to_owned(),
owned_room_id!("!a98sd12bjh:example.org"),
true,
None,
);

let actions = machine.process(IncomingMessage::WidgetMessage(json_string!({
"api": "fromWidget",
"widgetId": WIDGET_ID,
"requestId": "send_event-request-id",
"action": "send_event",
"data": {
"content": {},
"future_timeout": 10000,
"room_id": "!rXAYvblqYaGiJmeRdR:matrix.org",
"state_key": "_@abc:example.org_VFKPEKYWMP",
"type": "org.matrix.msc3401.call.member",
},
})));
println!("{:?}", actions);
}

0 comments on commit 0506014

Please sign in to comment.