summaryrefslogtreecommitdiffstats
path: root/src/routes.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/routes.rs')
-rw-r--r--src/routes.rs20
1 files changed, 8 insertions, 12 deletions
diff --git a/src/routes.rs b/src/routes.rs
index d9a2a0b..c83a3ee 100644
--- a/src/routes.rs
+++ b/src/routes.rs
@@ -40,13 +40,13 @@ mod tests {
use sqlx::PgPool;
use tower::ServiceExt;
- use crate::Error;
-
const JWT_SECRET: &str = "test-jwt-secret-token";
const JWT_MAX_AGE: time::Duration = time::Duration::HOUR;
+ type TestResult<T = (), E = Box<dyn std::error::Error>> = std::result::Result<T, E>;
+
#[sqlx::test]
- async fn test_route_not_found(pool: PgPool) -> Result<(), Error> {
+ async fn test_route_not_found(pool: PgPool) -> TestResult {
let state = Arc::new(AppState {
pool,
jwt_secret: JWT_SECRET.to_string(),
@@ -54,15 +54,11 @@ mod tests {
});
let router = init_router(state.clone());
- let response = router
- .oneshot(
- Request::builder()
- .uri("/does-not-exist")
- .body(Body::empty())
- .unwrap(),
- )
- .await
- .unwrap();
+ let request = Request::builder()
+ .uri("/does-not-exist")
+ .body(Body::empty())?;
+
+ let response = router.oneshot(request).await?;
assert_eq!(StatusCode::NOT_FOUND, response.status());