diff options
| author | Owen Jacobson <owen@grimoire.ca> | 2024-09-19 01:25:31 -0400 |
|---|---|---|
| committer | Owen Jacobson <owen@grimoire.ca> | 2024-09-20 23:55:22 -0400 |
| commit | e5f72711c5a17c5db24e209b14f82d426eceb86e (patch) | |
| tree | 04865172284c86549dd08d700c21a29c36f54005 /src/test/fixtures/message.rs | |
| parent | 0079624488af334817f58e30dbc676d3adde8de6 (diff) | |
Write tests.
Diffstat (limited to 'src/test/fixtures/message.rs')
| -rw-r--r-- | src/test/fixtures/message.rs | 26 |
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() +} |
