summaryrefslogtreecommitdiff
path: root/src/test/fixtures/message.rs
blob: 7fe3cb923ad7fe2ca9f5ff529a52b95694b4f7b8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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()
}