#[cfg(feature = "db")]
#[tokio::test]
async fn db_reexport_is_usable() {
use jerrycan::db::sea_orm::ConnectionTrait;
let db = jerrycan::db::Db::connect("sqlite::memory:").await.unwrap();
assert_eq!(db.backend(), jerrycan::db::Backend::Sqlite);
db.conn()
.execute_unprepared("CREATE TABLE t (x BIGINT)")
.await
.unwrap();
}
#[cfg(feature = "validate")]
#[test]
fn validate_reexport_is_usable() {
let v = jerrycan::validate::Violation::new("f", "m");
assert_eq!(v.field, "f");
}
#[cfg(feature = "auth")]
#[test]
fn auth_reexport_is_usable() {
let hash = jerrycan::auth::hash_password("pw").unwrap();
assert!(jerrycan::auth::verify_password("pw", &hash).unwrap());
}
#[cfg(feature = "observe")]
#[test]
fn observe_reexport_is_usable() {
let m = jerrycan::observe::Metrics::new();
m.record(200, 0.01);
assert!(m.render().contains("jerrycan_requests_total"));
}
#[cfg(feature = "jobs")]
#[test]
fn jobs_reexport_is_usable() {
let _migrations: &[jerrycan::db::Migration] = jerrycan::jobs::JOBS_MIGRATIONS;
let _jobs = jerrycan::jobs::Jobs::in_memory().queue("default", 4);
}
#[cfg(feature = "rate-limit")]
#[test]
fn rate_limit_and_cors_reach_through_the_facade() {
use jerrycan::ratelimit::RateLimit;
use jerrycan::{App, CorsConfig, CorsOrigins};
use std::time::Duration;
let _app = App::new()
.cors(CorsConfig::new(CorsOrigins::any()))
.extend(RateLimit::per_window(100, Duration::from_secs(60)));
}