summaryrefslogtreecommitdiff
path: root/src/test/fixtures/mod.rs
blob: 05e3f3ffc3963a0ec01fe94d1e98bcf15022071e (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
25
26
27
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()
}