From 32326a91f876cac92aea48f96499b4b9905d2bd7 Mon Sep 17 00:00:00 2001 From: andy Date: Tue, 11 May 2021 01:50:36 +0000 Subject: [PATCH] fix asserts in bank tests --- tests/test_bank.rs | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/tests/test_bank.rs b/tests/test_bank.rs index 2c1be0e..c0a1d64 100644 --- a/tests/test_bank.rs +++ b/tests/test_bank.rs @@ -293,8 +293,8 @@ async fn test_deposit_individual_item() { unknown: 0, })))).await.unwrap().collect::>(); - assert!(packets.len() == 1); - assert!(matches!(&packets[0], (ClientId(2), SendShipPacket::Message(Message {msg: GameMessage::PlayerNoLongerHasItem(player_no_longer_has_item)})) + assert!(packets.len() == 2); + assert!(matches!(&packets[1], (ClientId(2), SendShipPacket::Message(Message {msg: GameMessage::PlayerNoLongerHasItem(player_no_longer_has_item)})) if player_no_longer_has_item.item_id == 0x10001 && player_no_longer_has_item.amount == 0 )); @@ -356,8 +356,8 @@ async fn test_deposit_stacked_item() { unknown: 0, })))).await.unwrap().collect::>(); - assert!(packets.len() == 1); - assert!(matches!(&packets[0], (ClientId(2), SendShipPacket::Message(Message {msg: GameMessage::PlayerNoLongerHasItem(player_no_longer_has_item)})) + assert!(packets.len() == 2); + assert!(matches!(&packets[1], (ClientId(2), SendShipPacket::Message(Message {msg: GameMessage::PlayerNoLongerHasItem(player_no_longer_has_item)})) if player_no_longer_has_item.item_id == 0x10000 && player_no_longer_has_item.amount == 3 )); @@ -420,8 +420,8 @@ async fn test_deposit_partial_stacked_item() { unknown: 0, })))).await.unwrap().collect::>(); - assert!(packets.len() == 1); - assert!(matches!(&packets[0], (ClientId(2), SendShipPacket::Message(Message {msg: GameMessage::PlayerNoLongerHasItem(player_no_longer_has_item)})) + assert!(packets.len() == 2); + assert!(matches!(&packets[1], (ClientId(2), SendShipPacket::Message(Message {msg: GameMessage::PlayerNoLongerHasItem(player_no_longer_has_item)})) if player_no_longer_has_item.item_id == 0x10000 && player_no_longer_has_item.amount == 2 )); @@ -508,8 +508,8 @@ async fn test_deposit_stacked_item_with_stack_already_in_bank() { unknown: 0, })))).await.unwrap().collect::>(); - assert!(packets.len() == 1); - assert!(matches!(&packets[0], (ClientId(2), SendShipPacket::Message(Message {msg: GameMessage::PlayerNoLongerHasItem(player_no_longer_has_item)})) + assert!(packets.len() == 2); + assert!(matches!(&packets[1], (ClientId(2), SendShipPacket::Message(Message {msg: GameMessage::PlayerNoLongerHasItem(player_no_longer_has_item)})) if player_no_longer_has_item.item_id == 0x10000 && player_no_longer_has_item.amount == 2 )); @@ -1024,8 +1024,8 @@ async fn test_withdraw_individual_item() { unknown: 0, })))).await.unwrap().collect::>(); - assert!(packets.len() == 1); - assert!(matches!(&packets[0], (ClientId(2), SendShipPacket::Message(Message {msg: GameMessage::CreateItem(create_item)})) + assert!(packets.len() == 2); + assert!(matches!(&packets[1], (ClientId(2), SendShipPacket::Message(Message {msg: GameMessage::CreateItem(create_item)})) if create_item.item_id == 0x20000 )); @@ -1088,8 +1088,8 @@ async fn test_withdraw_stacked_item() { unknown: 0, })))).await.unwrap().collect::>(); - assert!(packets.len() == 1); - assert!(matches!(&packets[0], (ClientId(2), SendShipPacket::Message(Message {msg: GameMessage::CreateItem(create_item)})) + assert!(packets.len() == 2); + assert!(matches!(&packets[1], (ClientId(2), SendShipPacket::Message(Message {msg: GameMessage::CreateItem(create_item)})) if create_item.item_id == 0x10002 )); @@ -1151,8 +1151,8 @@ async fn test_withdraw_partial_stacked_item() { unknown: 0, })))).await.unwrap().collect::>(); - assert!(packets.len() == 1); - assert!(matches!(&packets[0], (ClientId(2), SendShipPacket::Message(Message {msg: GameMessage::CreateItem(create_item)})) + assert!(packets.len() == 2); + assert!(matches!(&packets[1], (ClientId(2), SendShipPacket::Message(Message {msg: GameMessage::CreateItem(create_item)})) if create_item.item_id == 0x10002 )); @@ -1236,8 +1236,8 @@ async fn test_withdraw_stacked_item_with_stack_already_in_inventory() { unknown: 0, })))).await.unwrap().collect::>(); - assert!(packets.len() == 1); - assert!(matches!(&packets[0], (ClientId(2), SendShipPacket::Message(Message {msg: GameMessage::CreateItem(create_item)})) + assert!(packets.len() == 2); + assert!(matches!(&packets[1], (ClientId(2), SendShipPacket::Message(Message {msg: GameMessage::CreateItem(create_item)})) if create_item.item_id == 0x10000 ));