Skip to content

Commit

Permalink
add tests to safe endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
m4salah committed Dec 14, 2023
1 parent ccc2f0c commit bb5ab31
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/handlers/day14.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,23 @@ mod tests {
.await;
assert_eq!(res.status(), StatusCode::OK);
}

#[tokio::test]
async fn day14_safe_santa() {
let app = router();

let client = TestClient::new(app);
let res = client
.post("/14/safe")
.body(
json!({
"content": "<script>alert(\"XSS Attack!\")</script>"
})
.to_string(),
)
.header(CONTENT_TYPE, "application/json")
.send()
.await;
assert_eq!(res.status(), StatusCode::OK);
}
}

0 comments on commit bb5ab31

Please sign in to comment.