summaryrefslogtreecommitdiff
path: root/src/test/fixtures/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/fixtures/mod.rs')
-rw-r--r--src/test/fixtures/mod.rs28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/test/fixtures/mod.rs b/src/test/fixtures/mod.rs
new file mode 100644
index 0000000..05e3f3f
--- /dev/null
+++ b/src/test/fixtures/mod.rs
@@ -0,0 +1,28 @@
+use chrono::{TimeDelta, Utc};
+
+use crate::{app::App, clock::RequestedAt, repo::pool};
+
+pub mod channel;
+pub mod error;
+pub mod future;
+pub mod identity;
+pub mod login;
+pub mod message;
+
+pub async fn scratch_app() -> App {
+ let pool = pool::prepare("sqlite::memory:")
+ .await
+ .expect("setting up in-memory sqlite database");
+ App::from(pool)
+ .await
+ .expect("creating an app from a fresh, in-memory database")
+}
+
+pub fn now() -> RequestedAt {
+ Utc::now().into()
+}
+
+pub fn ancient() -> RequestedAt {
+ let timestamp = Utc::now() - TimeDelta::days(365);
+ timestamp.into()
+}