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/channel.rs | |
| parent | 0079624488af334817f58e30dbc676d3adde8de6 (diff) | |
Write tests.
Diffstat (limited to 'src/test/fixtures/channel.rs')
| -rw-r--r-- | src/test/fixtures/channel.rs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/test/fixtures/channel.rs b/src/test/fixtures/channel.rs new file mode 100644 index 0000000..0558395 --- /dev/null +++ b/src/test/fixtures/channel.rs @@ -0,0 +1,24 @@ +use faker_rand::{ + en_us::{addresses::CityName, names::FullName}, + faker_impl_from_templates, +}; +use rand; + +use crate::{app::App, repo::channel::Channel}; + +pub async fn create(app: &App) -> Channel { + let name = propose(); + app.channels() + .create(&name) + .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; +} |
