Skip to content

Commit

Permalink
Add problem delete event test
Browse files Browse the repository at this point in the history
  • Loading branch information
smrtrfszm committed Jun 27, 2024
1 parent 5a70d50 commit 03ac4e1
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions tests/problem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -316,9 +316,9 @@ mod delete {
#[parallel]
async fn success() {
let app = get_cached_app().await;

let user = utils::iam::register_user().await;
let user = app.register_user().await;
utils::iam::make_admin(&user).await;
let _team = app.create_team(&user).await;

let res = app
.post("/problem")
Expand All @@ -338,6 +338,9 @@ mod delete {
res.json::<Value>().await,
);

let mut socket = app.socket("/ws").start().await;
assert_team_info!(socket, user);

let body: Value = res.json().await;
let id = body["id"].as_str().unwrap();

Expand All @@ -353,6 +356,18 @@ mod delete {
"failed to delete problem: response={:#?}",
res.json::<Value>().await,
);

let message = utils::get_socket_message(socket.next().await);

assert_json_eq!(
message,
json!({
"event": "DELETE_PROBLEM",
"data": {
"id": id,
},
}),
);
}

#[tokio::test]
Expand Down

0 comments on commit 03ac4e1

Please sign in to comment.