From a4f9a82477fc58ad285a5d31e1ba71387f4e83d5 Mon Sep 17 00:00:00 2001 From: shockrahwow Date: Thu, 5 Dec 2019 11:15:42 -0800 Subject: [PATCH] more tests for jjs and more robust macro --- server/src/main.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/server/src/main.rs b/server/src/main.rs index 4e305dc..75098f6 100644 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -56,7 +56,11 @@ mod test { ($client:expr, $file:expr) => { let response = $client.get($file).dispatch(); assert_eq!(response.status(), Status::Ok); - } + }; + ($client:expr, $file:expr, $code:expr) => { + let response = $client.get($file).dispatch(); + assert_eq!(response.status(), $code); + }; } #[test] fn pageroutes_get() { @@ -73,9 +77,16 @@ mod test { check_get!(client, "/static/css/about.css"); } + // this one is meant to fail for now because we don't have any js to serve #[test] fn static_media_get() { let client = Client::new(rocket()).expect("Valid rocket instance"); check_get!(client, "/static/media/favicon.png"); } + + #[test] + fn static_js_get() { + let client = Client::new(rocket()).expect("Valid rocket instance"); + check_get!(client, "/static/js/jquery.js", Status::NotFound); + } }