summaryrefslogtreecommitdiff
path: root/src/test/fixtures/message.rs
blob: fd508870730c6ed851685f8f331b83fa5df7572b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
use faker_rand::lorem::Paragraphs;

use crate::{app::App, channel::Channel, clock::RequestedAt, event::types, login::Login};

pub async fn send(
    app: &App,
    login: &Login,
    channel: &Channel,
    sent_at: &RequestedAt,
) -> types::ChannelEvent {
    let body = propose();

    app.events()
        .send(login, &channel.id, &body, sent_at)
        .await
        .expect("should succeed if the channel exists")
}

pub fn propose() -> String {
    rand::random::<Paragraphs>().to_string()
}