summaryrefslogtreecommitdiff
path: root/src/test/fixtures/channel.rs
blob: 874447092715e67a5c1f42a4aa86aa2cd5932010 (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
use faker_rand::{
    en_us::{addresses::CityName, names::FullName},
    faker_impl_from_templates,
};
use rand;

use crate::{app::App, clock::RequestedAt, repo::channel::Channel};

pub async fn create(app: &App, created_at: &RequestedAt) -> Channel {
    let name = propose();
    app.channels()
        .create(&name, created_at)
        .await
        .expect("should always succeed if the channel is actually new")
}

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

struct Name(String);
faker_impl_from_templates! {
    Name; "{} {}", CityName, FullName;
}