From e5f72711c5a17c5db24e209b14f82d426eceb86e Mon Sep 17 00:00:00 2001 From: Owen Jacobson Date: Thu, 19 Sep 2024 01:25:31 -0400 Subject: Write tests. --- src/test/fixtures/channel.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/test/fixtures/channel.rs (limited to 'src/test/fixtures/channel.rs') 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::().to_string() +} + +struct Name(String); +faker_impl_from_templates! { + Name; "{} {}", CityName, FullName; +} -- cgit v1.2.3