Browse Source

fix anyhow-inflicted tests

pull/127/head
jake 2 years ago
parent
commit
62387366e4
  1. 3
      tests/test_shops.rs
  2. 6
      tests/test_trade.rs

3
tests/test_shops.rs

@ -1143,7 +1143,8 @@ async fn test_player_cant_sell_if_meseta_would_go_over_max() {
amount: 1,
})))).await.err().unwrap();
//assert_eq!(ack, ShipError::ItemStateError(ItemStateError::FullOfMeseta));
assert!(matches!(ack.downcast::<ShipError>().unwrap(), ShipError::ItemStateError(ItemStateError::FullOfMeseta)));
assert!(matches!(ack.downcast::<ItemStateError>().unwrap(), ItemStateError::FullOfMeseta));
//assert!(matches!(ack.downcast::<ShipError>().unwrap(), ShipError::ItemStateError(ItemStateError::FullOfMeseta)));
let c1_meseta = entity_gateway.get_character_meseta(&char1.id).await.unwrap();
assert_eq!(c1_meseta.0, 999995);

6
tests/test_trade.rs

@ -3155,7 +3155,7 @@ async fn test_client_tries_to_start_two_trades() {
trade: TradeRequestCommand::Initialize(TradeRequestInitializeCommand::Initialize, 0)
})))).await.err().unwrap();
assert!(matches!(ack.downcast::<ShipError>().unwrap(), ShipError::TradeError(TradeError::ClientAlreadyInTrade)));
assert!(matches!(ack.downcast::<TradeError>().unwrap(), TradeError::ClientAlreadyInTrade));
}
#[async_std::test]
@ -3187,14 +3187,14 @@ async fn test_client_tries_trading_with_client_already_trading() {
target: 0,
trade: TradeRequestCommand::Initialize(TradeRequestInitializeCommand::Initialize, 0)
})))).await.err().unwrap();
assert!(matches!(ack.downcast::<ShipError>().unwrap(), ShipError::TradeError(TradeError::OtherAlreadyInTrade)));
assert!(matches!(ack.downcast::<TradeError>().unwrap(), TradeError::OtherAlreadyInTrade));
let ack = ship.handle(ClientId(3), RecvShipPacket::DirectMessage(DirectMessage::new(1, GameMessage::TradeRequest(TradeRequest {
client: 2,
target: 0,
trade: TradeRequestCommand::Initialize(TradeRequestInitializeCommand::Initialize, 1)
})))).await.err().unwrap();
assert!(matches!(ack.downcast::<ShipError>().unwrap(), ShipError::TradeError(TradeError::OtherAlreadyInTrade)));
assert!(matches!(ack.downcast::<TradeError>().unwrap(), TradeError::OtherAlreadyInTrade));
}
#[async_std::test]

Loading…
Cancel
Save