diff --git a/tests/test_shops.rs b/tests/test_shops.rs index 1838414..10a4df6 100644 --- a/tests/test_shops.rs +++ b/tests/test_shops.rs @@ -259,7 +259,51 @@ async fn test_player_buys_from_armor_shop() { } #[async_std::test] -async fn test_player_sells_to_shop() { +async fn test_player_sells_3_attr_weapon_to_shop() { + let mut entity_gateway = InMemoryGateway::default(); + + let (user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await; + + let mut p1_inv = Vec::new(); + + p1_inv.push(entity_gateway.create_item( + item::NewItemEntity { + item: item::ItemDetail::Weapon( + item::weapon::Weapon { + weapon: item::weapon::WeaponType::Vulcan, + grind: 5, + special: Some(item::weapon::WeaponSpecial::Charge), + attrs: [Some(item::weapon::WeaponAttribute{attr: item::weapon::Attribute::Hit, value: 100}), + Some(item::weapon::WeaponAttribute{attr: item::weapon::Attribute::Dark, value: 100}), + Some(item::weapon::WeaponAttribute{attr: item::weapon::Attribute::Native, value: 100}),], + tekked: true, + } + ), + location: item::ItemLocation::Inventory { + character_id: char1.id, + } + }).await.unwrap()); + + entity_gateway.set_character_inventory(&char1.id, &item::InventoryEntity::new(p1_inv)).await.unwrap(); + + let mut ship = Box::new(ShipServerState::builder() + .gateway(entity_gateway.clone()) + .build()); + + log_in_char(&mut ship, ClientId(1), "a1", "a").await; + join_lobby(&mut ship, ClientId(1)).await; + create_room_with_difficulty(&mut ship, ClientId(1), "room", "", Difficulty::Ultimate).await; + + ship.handle(ClientId(1), &RecvShipPacket::Message(Message::new(GameMessage::PlayerSoldItem(PlayerSoldItem { + client: 0, + target: 0, + item_id: 0x10000, + amount: 1, + })))).await.unwrap().for_each(drop); + + let characters1 = entity_gateway.get_characters_by_user(&user1).await.unwrap(); + let c1 = characters1.get(0).as_ref().unwrap().as_ref().unwrap(); + assert_eq!(c1.meseta, 4406); } #[async_std::test]