Add tests for the static file handler
This commit is contained in:
parent
8863b87c4e
commit
3251d098bd
|
@ -5,3 +5,19 @@ use rocket::response::NamedFile;
|
|||
fn all(path: PathBuf) -> Option<NamedFile> {
|
||||
NamedFile::open(Path::new("static/").join(path)).ok()
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use rocket;
|
||||
use rocket::http::Status;
|
||||
use rocket::local::Client;
|
||||
|
||||
#[test]
|
||||
fn all() {
|
||||
let client = Client::new(rocket(Some("test"))).unwrap();
|
||||
|
||||
// Try to get the main JavaScript file
|
||||
let res = client.get("/js/wishlists.js").dispatch();
|
||||
assert_eq!(res.status(), Status::Ok);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue