1
0
Fork 0
mirror of https://github.com/actix/actix-web.git synced 2024-12-29 19:40:34 +00:00

add websocket empty close status test

This commit is contained in:
Nathan Fox 2018-04-20 21:55:07 -04:00
parent 5528cf62f0
commit dc9a24a189

View file

@ -60,6 +60,16 @@ fn test_simple() {
assert_eq!(item, Some(ws::Message::Close(ws::CloseCode::Normal)));
}
#[test]
fn test_empty_close_code() {
let mut srv = test::TestServer::new(|app| app.handler(|req| ws::start(req, Ws)));
let (reader, mut writer) = srv.ws().unwrap();
writer.close(ws::CloseCode::Empty, "");
let (item, _) = srv.execute(reader.into_future()).unwrap();
assert_eq!(item, Some(ws::Message::Close(ws::CloseCode::Status)));
}
#[test]
fn test_large_text() {
let data = rand::thread_rng()