summaryrefslogtreecommitdiff
path: root/src/test/fixtures/message.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/fixtures/message.rs')
-rw-r--r--src/test/fixtures/message.rs26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/test/fixtures/message.rs b/src/test/fixtures/message.rs
new file mode 100644
index 0000000..7fe3cb9
--- /dev/null
+++ b/src/test/fixtures/message.rs
@@ -0,0 +1,26 @@
+use faker_rand::lorem::Paragraphs;
+
+use crate::{
+ app::App,
+ clock::RequestedAt,
+ events::repo::broadcast,
+ repo::{channel::Channel, login::Login},
+};
+
+pub async fn send(
+ app: &App,
+ login: &Login,
+ channel: &Channel,
+ sent_at: &RequestedAt,
+) -> broadcast::Message {
+ let body = propose();
+
+ app.channels()
+ .send(login, &channel.id, &body, sent_at)
+ .await
+ .expect("should succeed if the channel exists")
+}
+
+pub fn propose() -> String {
+ rand::random::<Paragraphs>().to_string()
+}