summaryrefslogtreecommitdiff
path: root/src/test/fixtures/login.rs
diff options
context:
space:
mode:
authorOwen Jacobson <owen@grimoire.ca>2024-10-24 22:37:22 -0400
committerOwen Jacobson <owen@grimoire.ca>2024-10-24 22:37:22 -0400
commit0bb17bd01640492db2685e67bacac12dd54a9f59 (patch)
tree5c8425b8e6a962e609f82a7b3f2498524d8d6c6f /src/test/fixtures/login.rs
parentd97f8ac1858fbd46b77b541a612cc37b07fc0b5d (diff)
Tests for channel, invite, setup, and message deletion events.
This also found a bug! No live event was being emitted during invite accept. The only way to find out about invites was to reconnect.
Diffstat (limited to 'src/test/fixtures/login.rs')
-rw-r--r--src/test/fixtures/login.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/test/fixtures/login.rs b/src/test/fixtures/login.rs
index e308289..cbcbdd4 100644
--- a/src/test/fixtures/login.rs
+++ b/src/test/fixtures/login.rs
@@ -1,9 +1,12 @@
+use std::future::{self, Ready};
+
use faker_rand::en_us::internet;
use uuid::Uuid;
use crate::{
app::App,
clock::RequestedAt,
+ event::Event,
login::{self, Login, Password},
name::Name,
};
@@ -45,3 +48,16 @@ fn propose_name() -> Name {
pub fn propose_password() -> Password {
Uuid::new_v4().to_string().into()
}
+
+pub fn events(event: Event) -> Ready<Option<login::Event>> {
+ future::ready(match event {
+ Event::Login(event) => Some(event),
+ _ => None,
+ })
+}
+
+pub fn created(event: login::Event) -> Ready<Option<login::event::Created>> {
+ future::ready(match event {
+ login::Event::Created(event) => Some(event),
+ })
+}