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

use crate::{app::App, channel::Channel, clock::RequestedAt, login::Login, message::Message};

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

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

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