use std::path::{Path,PathBuf};
use rocket::response::NamedFile;

#[get("/<path..>", rank = 5)]
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);
    }
}
