Skip to content

Commit

Permalink
✅ Add failure test
Browse files Browse the repository at this point in the history
  • Loading branch information
H1rono committed Dec 11, 2024
1 parent 271ab7a commit b7dedfc
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/parser/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ mod tests {
use http_body_util::BodyExt;

use super::{CollectBody, ParseRequest};
use crate::{Event, EventKind};
use crate::{Error, ErrorKind, Event, EventKind};

#[test]
fn collect_body() {
Expand All @@ -294,4 +294,13 @@ mod tests {
let event = block_on(fut).unwrap();
assert!(matches!(event, Event::Ping(_)));
}

#[test]
fn parse_event_failed() {
let err: Error = ErrorKind::BotTokenMismatch.into();
let body = String::new();
let fut = ParseRequest::new(Err(err), body);
let err = block_on(fut).unwrap_err();
assert_eq!(err.kind(), ErrorKind::BotTokenMismatch);
}
}

0 comments on commit b7dedfc

Please sign in to comment.