added testing module to the controllers

This commit is contained in:
Gonçalo Valério 2019-03-25 23:10:36 +00:00
parent a8c247ccdd
commit f66a16c34c
1 changed files with 12 additions and 0 deletions

View File

@ -3,3 +3,15 @@ use actix_web::{HttpRequest, Responder};
pub fn index(_req: &HttpRequest) -> impl Responder {
"Hello world!"
}
#[cfg(test)]
mod tests {
use super::*;
use actix_web::{http, test};
#[test]
fn test_index() {
let resp = test::TestRequest::default().run(&index).unwrap();
assert_eq!(resp.status(), http::StatusCode::OK);
}
}