Browse Source

why did that arg ever exist anyway

pull/135/head
jake 1 year ago
committed by andy
parent
commit
0a0542f642
  1. 2
      tests/common.rs
  2. 86
      tests/test_bank.rs
  3. 2
      tests/test_character.rs
  4. 10
      tests/test_exp_gain.rs
  5. 6
      tests/test_item_actions.rs
  6. 10
      tests/test_item_drop.rs
  7. 12
      tests/test_item_id.rs
  8. 42
      tests/test_item_pickup.rs
  9. 16
      tests/test_item_use.rs
  10. 8
      tests/test_mags.rs
  11. 16
      tests/test_rooms.rs
  12. 58
      tests/test_shops.rs
  13. 156
      tests/test_trade.rs

2
tests/common.rs

@ -77,7 +77,7 @@ pub fn standard_ship<EG: EntityGateway + Clone>(gateway: EG) -> ShipServerState
}
//TODO: remove kb_conf_preset
pub async fn new_user_character<EG: EntityGateway + Clone>(entity_gateway: &mut EG, username: &str, password: &str, _kb_conf_preset: usize) -> (UserAccountEntity, CharacterEntity) {
pub async fn new_user_character<EG: EntityGateway + Clone>(entity_gateway: &mut EG, username: &str, password: &str) -> (UserAccountEntity, CharacterEntity) {
let new_user = NewUserAccountEntity {
email: format!("{}@pso.com", username),
username: username.into(),

86
tests/test_bank.rs

@ -16,8 +16,8 @@ use common::*;
async fn test_bank_items_sent_in_character_login() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user2, _char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let (_user2, _char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
let item = entity_gateway.create_item(
item::NewItemEntity {
@ -49,8 +49,8 @@ async fn test_bank_items_sent_in_character_login() {
async fn test_request_bank_items() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user2, _char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let (_user2, _char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
let mut bank = Vec::new();
for _ in 0..3 {
@ -95,8 +95,8 @@ async fn test_request_bank_items() {
async fn test_request_stacked_bank_items() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user2, _char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let (_user2, _char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
let mut monomates = Vec::new();
for _ in 0..3usize {
@ -136,8 +136,8 @@ async fn test_request_stacked_bank_items() {
async fn test_request_bank_items_sorted() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user2, _char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let (_user2, _char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
let item1 = entity_gateway.create_item(
item::NewItemEntity {
@ -200,8 +200,8 @@ async fn test_request_bank_items_sorted() {
async fn test_deposit_individual_item() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user2, _char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let (_user2, _char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
let item0 = entity_gateway.create_item(
item::NewItemEntity {
@ -277,8 +277,8 @@ async fn test_deposit_individual_item() {
async fn test_deposit_stacked_item() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user2, _char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let (_user2, _char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
let mut monomates = Vec::new();
for _ in 0..3usize {
@ -336,8 +336,8 @@ async fn test_deposit_stacked_item() {
async fn test_deposit_partial_stacked_item() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user2, _char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let (_user2, _char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
let mut monomates = Vec::new();
for _ in 0..3usize {
@ -404,8 +404,8 @@ async fn test_deposit_partial_stacked_item() {
async fn test_deposit_stacked_item_with_stack_already_in_bank() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user2, _char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let (_user2, _char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
let mut bank_monomates = Vec::new();
let mut inventory_monomates = Vec::new();
@ -474,7 +474,7 @@ async fn test_deposit_stacked_item_with_stack_already_in_bank() {
async fn test_deposit_stacked_item_with_full_stack_in_bank() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let mut inventory_monomates = Vec::new();
for _ in 0..2usize {
@ -544,7 +544,7 @@ async fn test_deposit_stacked_item_with_full_stack_in_bank() {
async fn test_deposit_individual_item_in_full_bank() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let mut inventory = Vec::new();
inventory.push(entity_gateway.create_item(
@ -616,7 +616,7 @@ async fn test_deposit_individual_item_in_full_bank() {
async fn test_deposit_stacked_item_in_full_bank() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let mut monomates = Vec::new();
for _ in 0..2usize {
@ -687,7 +687,7 @@ async fn test_deposit_stacked_item_in_full_bank() {
async fn test_deposit_stacked_item_in_full_bank_with_partial_stack() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let mut monomates = Vec::new();
for _ in 0..2usize {
@ -768,7 +768,7 @@ async fn test_deposit_stacked_item_in_full_bank_with_partial_stack() {
async fn test_deposit_meseta() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
entity_gateway.set_character_meseta(&char1.id, item::Meseta(300)).await.unwrap();
let mut ship = standard_ship(entity_gateway.clone());
@ -802,7 +802,7 @@ async fn test_deposit_meseta() {
async fn test_deposit_too_much_meseta() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
entity_gateway.set_character_meseta(&char1.id, item::Meseta(300)).await.unwrap();
entity_gateway.set_bank_meseta(&char1.id, &item::BankIdentifier::Character, item::Meseta(999980)).await.unwrap();
@ -839,7 +839,7 @@ async fn test_deposit_too_much_meseta() {
async fn test_deposit_meseta_when_bank_is_maxed() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
entity_gateway.set_character_meseta(&char1.id, item::Meseta(300)).await.unwrap();
entity_gateway.set_bank_meseta(&char1.id, &item::BankIdentifier::Character, item::Meseta(999999)).await.unwrap();
@ -877,8 +877,8 @@ async fn test_deposit_meseta_when_bank_is_maxed() {
async fn test_withdraw_individual_item() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user2, _char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let (_user2, _char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
let mut bank = Vec::new();
bank.push(entity_gateway.create_item(
@ -937,8 +937,8 @@ async fn test_withdraw_individual_item() {
async fn test_withdraw_stacked_item() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user2, _char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let (_user2, _char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
let mut monomates = Vec::new();
for _ in 0..3usize {
@ -995,8 +995,8 @@ async fn test_withdraw_stacked_item() {
async fn test_withdraw_partial_stacked_item() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user2, _char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let (_user2, _char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
let mut monomates = Vec::new();
for _ in 0..3usize {
@ -1059,8 +1059,8 @@ async fn test_withdraw_partial_stacked_item() {
async fn test_withdraw_stacked_item_with_stack_already_in_inventory() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user2, _char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let (_user2, _char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
let mut inventory_monomates = Vec::new();
let mut bank_monomates = Vec::new();
@ -1131,7 +1131,7 @@ async fn test_withdraw_stacked_item_with_stack_already_in_inventory() {
async fn test_withdraw_stacked_item_with_full_stack_in_inventory() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let mut bank_monomates = Vec::new();
for _ in 0..2usize {
@ -1201,7 +1201,7 @@ async fn test_withdraw_stacked_item_with_full_stack_in_inventory() {
async fn test_withdraw_individual_item_in_full_inventory() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let mut bank = Vec::new();
bank.push(entity_gateway.create_item(
@ -1269,7 +1269,7 @@ async fn test_withdraw_individual_item_in_full_inventory() {
async fn test_withdraw_stacked_item_in_full_inventory() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let mut monomates = Vec::new();
for _ in 0..2usize {
@ -1341,7 +1341,7 @@ async fn test_withdraw_stacked_item_in_full_inventory() {
async fn test_withdraw_stacked_item_in_full_inventory_with_partial_stack() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let mut bank_item = Vec::new();
for _ in 0..2usize {
@ -1425,7 +1425,7 @@ async fn test_withdraw_stacked_item_in_full_inventory_with_partial_stack() {
async fn test_withdraw_meseta() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
entity_gateway.set_bank_meseta(&char1.id, &item::BankIdentifier::Character, item::Meseta(300)).await.unwrap();
let mut ship = standard_ship(entity_gateway.clone());
@ -1459,7 +1459,7 @@ async fn test_withdraw_meseta() {
async fn test_withdraw_too_much_meseta() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
entity_gateway.set_character_meseta(&char1.id, item::Meseta(999980)).await.unwrap();
entity_gateway.set_bank_meseta(&char1.id, &item::BankIdentifier::Character, item::Meseta(300)).await.unwrap();
@ -1496,7 +1496,7 @@ async fn test_withdraw_too_much_meseta() {
async fn test_withdraw_meseta_inventory_is_maxed() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
entity_gateway.set_character_meseta(&char1.id, item::Meseta(999999)).await.unwrap();
entity_gateway.set_bank_meseta(&char1.id, &item::BankIdentifier::Character, item::Meseta(300)).await.unwrap();
@ -1535,7 +1535,7 @@ async fn test_withdraw_meseta_inventory_is_maxed() {
async fn test_withdraw_meseta_and_buy_a_few_monomates_with_it() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
entity_gateway.set_character_meseta(&char1.id, item::Meseta(100)).await.unwrap();
entity_gateway.set_bank_meseta(&char1.id, &item::BankIdentifier::Character, item::Meseta(300)).await.unwrap();
@ -1587,7 +1587,7 @@ async fn test_withdraw_meseta_and_buy_a_few_monomates_with_it() {
async fn test_deposit_items_into_shared_banks() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let item0 = entity_gateway.create_item(ItemBuilder::weapon(item::weapon::WeaponType::Saber).as_new()).await.unwrap();
let item1 = entity_gateway.create_item(ItemBuilder::weapon(item::weapon::WeaponType::Buster).as_new()).await.unwrap();
@ -1709,7 +1709,7 @@ async fn test_deposit_items_into_shared_banks() {
async fn test_deposit_meseta_into_shared_banks() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
entity_gateway.set_character_meseta(&char1.id, item::Meseta(300)).await.unwrap();
let mut ship = standard_ship(entity_gateway.clone());
@ -1784,7 +1784,7 @@ async fn test_deposit_meseta_into_shared_banks() {
async fn test_withdraw_items_from_shared_banks() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let item0 = entity_gateway.create_item(ItemBuilder::weapon(item::weapon::WeaponType::Saber).as_new()).await.unwrap();
let item1 = entity_gateway.create_item(ItemBuilder::weapon(item::weapon::WeaponType::Buster).as_new()).await.unwrap();
@ -1894,7 +1894,7 @@ async fn test_withdraw_items_from_shared_banks() {
async fn test_withdraw_meseta_from_shared_banks() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
entity_gateway.set_bank_meseta(&char1.id, &item::BankIdentifier::Character, item::Meseta(300)).await.unwrap();
entity_gateway.set_bank_meseta(&char1.id, &item::BankIdentifier::Shared(item::BankName("asdf".into())), item::Meseta(300)).await.unwrap();
entity_gateway.set_bank_meseta(&char1.id, &item::BankIdentifier::Shared(item::BankName("qwer".into())), item::Meseta(300)).await.unwrap();

2
tests/test_character.rs

@ -13,7 +13,7 @@ use common::*;
async fn test_save_options() {
let mut entity_gateway = InMemoryGateway::default();
let (user1, _char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (user1, _char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let mut ship = standard_ship(entity_gateway.clone());
log_in_char(&mut ship, ClientId(1), "a1", "a").await;

10
tests/test_exp_gain.rs

@ -19,7 +19,7 @@ use common::*;
async fn test_character_gains_exp() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, _char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user1, _char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let mut ship = standard_ship_buildable(entity_gateway.clone())
.map_builder(Box::new(|_room_mode, _event| {
@ -52,7 +52,7 @@ async fn test_character_gains_exp() {
async fn test_character_levels_up() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
char1.exp = 49;
entity_gateway.save_character(&char1).await.unwrap();
@ -90,7 +90,7 @@ async fn test_character_levels_up() {
async fn test_character_levels_up_multiple_times() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, _char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user1, _char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let mut ship = standard_ship_buildable(entity_gateway.clone())
.map_builder(Box::new(|_room_mode, _event| {
@ -125,8 +125,8 @@ async fn test_character_levels_up_multiple_times() {
async fn test_one_character_gets_full_exp_and_other_attacker_gets_partial() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, _char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user2, _char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
let (_user1, _char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let (_user2, _char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
let mut ship = standard_ship_buildable(entity_gateway.clone())
.map_builder(Box::new(|_room_mode, _event| {

6
tests/test_item_actions.rs

@ -14,7 +14,7 @@ use common::*;
async fn test_equip_unit_from_equip_menu() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
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(
@ -89,7 +89,7 @@ async fn test_equip_unit_from_equip_menu() {
async fn test_unequip_armor_with_units() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
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(
@ -155,7 +155,7 @@ async fn test_unequip_armor_with_units() {
async fn test_sort_items() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
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(

10
tests/test_item_drop.rs

@ -20,7 +20,7 @@ use common::*;
#[async_std::test]
async fn test_enemy_drops_item() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, _char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user1, _char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let mut ship = standard_ship_buildable(entity_gateway.clone())
.map_builder(Box::new(|_room_mode, _event| {
@ -74,8 +74,8 @@ async fn test_enemy_drops_item() {
#[async_std::test]
async fn test_enemy_drops_item_for_two_players() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, _char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user2, _char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
let (_user1, _char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let (_user2, _char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
let mut ship = standard_ship_buildable(entity_gateway.clone())
.map_builder(Box::new(|_room_mode, _event| {
@ -141,8 +141,8 @@ async fn test_enemy_drops_item_for_two_players() {
#[async_std::test]
async fn test_enemy_drops_item_for_two_players_and_pick_up() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, _char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user2, _char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
let (_user1, _char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let (_user2, _char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
let mut ship = standard_ship_buildable(entity_gateway.clone())
.map_builder(Box::new(|_room_mode, _event| {

12
tests/test_item_id.rs

@ -14,8 +14,8 @@ use common::*;
#[async_std::test]
async fn test_use_monomate_after_leaving_and_rejoining_room() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
let mut p1_items = Vec::new();
for tool in vec![item::tool::ToolType::Monomate, item::tool::ToolType::Monofluid].into_iter() {
@ -107,9 +107,9 @@ async fn test_use_monomate_after_leaving_and_rejoining_room() {
#[async_std::test]
async fn test_using_some_monomates_after_a_convoluted_series_of_leaves_and_joins() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
let (_user3, char3) = new_user_character(&mut entity_gateway, "a3", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
let (_user3, char3) = new_user_character(&mut entity_gateway, "a3", "a").await;
let mut p1_items = Vec::new();
for tool in vec![item::tool::ToolType::Monofluid, item::tool::ToolType::Difluid, item::tool::ToolType::Trifluid].into_iter() {
@ -294,7 +294,7 @@ async fn test_using_some_monomates_after_a_convoluted_series_of_leaves_and_joins
#[async_std::test]
async fn test_depositing_a_full_stack_then_withdrawing_part() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let mut p1_items = Vec::new();
for tool in vec![item::tool::ToolType::Monofluid, item::tool::ToolType::Difluid, item::tool::ToolType::Trifluid].into_iter() {

42
tests/test_item_pickup.rs

@ -14,8 +14,8 @@ use common::*;
async fn test_pick_up_individual_item() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
let mut p1_inv = Vec::new();
p1_inv.push(entity_gateway.create_item(
@ -83,8 +83,8 @@ async fn test_pick_up_individual_item() {
async fn test_pick_up_item_stack_of_items_already_in_inventory() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
let mut p1_monomate = Vec::new();
p1_monomate.push(entity_gateway.create_item(
@ -157,8 +157,8 @@ async fn test_pick_up_item_stack_of_items_already_in_inventory() {
async fn test_pick_up_item_stack_of_items_not_already_held() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
let mut p2_monomate = Vec::new();
p2_monomate.push(entity_gateway.create_item(
@ -214,8 +214,8 @@ async fn test_pick_up_item_stack_of_items_not_already_held() {
async fn test_pick_up_meseta_when_inventory_full() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
let mut p1_items = Vec::new();
for _ in 0..30usize {
@ -285,8 +285,8 @@ async fn test_pick_up_meseta_when_inventory_full() {
async fn test_pick_up_partial_stacked_item_when_inventory_is_otherwise_full() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
let mut p1_inv = Vec::new();
for _slot in 0..29usize {
@ -366,8 +366,8 @@ async fn test_pick_up_partial_stacked_item_when_inventory_is_otherwise_full() {
async fn test_can_not_pick_up_item_when_inventory_full() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
let mut p1_inv = Vec::new();
for _slot in 0..30usize {
@ -454,7 +454,7 @@ async fn test_can_not_pick_up_item_when_inventory_full() {
async fn test_can_not_drop_more_meseta_than_is_held() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
entity_gateway.set_character_meseta(&char1.id, item::Meseta(300)).await.unwrap();
@ -492,8 +492,8 @@ async fn test_can_not_drop_more_meseta_than_is_held() {
async fn test_pick_up_stack_that_would_exceed_stack_limit() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
let mut p1_monomates = Vec::new();
for _ in 0..6usize {
@ -564,8 +564,8 @@ async fn test_pick_up_stack_that_would_exceed_stack_limit() {
async fn test_can_not_pick_up_meseta_when_full() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
entity_gateway.set_character_meseta(&char1.id, item::Meseta(999999)).await.unwrap();
entity_gateway.set_character_meseta(&char2.id, item::Meseta(300)).await.unwrap();
@ -617,8 +617,8 @@ async fn test_can_not_pick_up_meseta_when_full() {
async fn test_meseta_caps_at_999999_when_trying_to_pick_up_more() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
entity_gateway.set_character_meseta(&char1.id, item::Meseta(999998)).await.unwrap();
entity_gateway.set_character_meseta(&char2.id, item::Meseta(300)).await.unwrap();
@ -669,8 +669,8 @@ async fn test_meseta_caps_at_999999_when_trying_to_pick_up_more() {
async fn test_player_drops_partial_stack_and_other_player_picks_it_up() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
let mut monomates = Vec::new();
for _ in 0..5usize {

16
tests/test_item_use.rs

@ -16,7 +16,7 @@ use common::*;
async fn test_use_monomate() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let mut p1_items = Vec::new();
for tool in vec![item::tool::ToolType::Monomate, item::tool::ToolType::Monofluid].into_iter() {
@ -61,7 +61,7 @@ async fn test_use_monomate() {
async fn test_use_monomate_twice() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let mut p1_items = Vec::new();
for tool in vec![item::tool::ToolType::Monomate, item::tool::ToolType::Monofluid].into_iter() {
@ -111,7 +111,7 @@ async fn test_use_monomate_twice() {
async fn test_use_last_monomate() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let mut p1_inv = Vec::new();
for tool in vec![item::tool::ToolType::Monomate, item::tool::ToolType::Monofluid].into_iter() {
@ -151,7 +151,7 @@ async fn test_use_last_monomate() {
async fn test_use_nonstackable_tool() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let mut p1_items = Vec::new();
p1_items.push(entity_gateway.create_item(
@ -184,7 +184,7 @@ async fn test_use_nonstackable_tool() {
async fn test_use_materials() {
let mut entity_gateway = InMemoryGateway::default();
let (user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let mut p1_inv = Vec::new();
for tool in vec![item::tool::ToolType::PowerMaterial, item::tool::ToolType::LuckMaterial].into_iter() {
@ -244,7 +244,7 @@ async fn test_use_materials() {
#[async_std::test]
async fn test_jackolantern() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let p1_inv = vec![
item::InventoryItemEntity::Stacked(
@ -297,7 +297,7 @@ async fn test_jackolantern() {
async fn test_use_barta_1() {
let mut entity_gateway = InMemoryGateway::default();
let (user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let inv = vec![
entity_gateway.create_item(
@ -365,7 +365,7 @@ async fn test_use_barta_1() {
async fn test_use_monogrinder() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let saber = entity_gateway.create_item(
item::NewItemEntity {

8
tests/test_mags.rs

@ -15,7 +15,7 @@ use common::*;
async fn test_mag_feed() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let mag = entity_gateway.create_item(
item::NewItemEntity {
@ -85,8 +85,8 @@ async fn test_mag_feed() {
async fn test_mag_change_owner() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user2, mut char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
let (_user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let (_user2, mut char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
char1.char_class = CharacterClass::RAmarl;
char1.section_id = SectionID::Redria;
entity_gateway.save_character(&char1).await.unwrap();
@ -148,7 +148,7 @@ async fn test_mag_change_owner() {
async fn test_mag_cell() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let mag = entity_gateway.create_item(
item::NewItemEntity {

16
tests/test_rooms.rs

@ -13,7 +13,7 @@ use common::*;
#[async_std::test]
async fn test_set_valid_quest_group() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, _char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user1, _char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let mut ship = standard_ship_buildable(entity_gateway.clone())
.standard_quest_builder(Box::new(quests::load_standard_quests))
.build();
@ -33,7 +33,7 @@ async fn test_set_valid_quest_group() {
#[async_std::test]
async fn test_set_invalid_quest_group() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, _char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user1, _char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let mut ship = standard_ship_buildable(entity_gateway.clone())
.standard_quest_builder(Box::new(quests::load_standard_quests))
.government_quest_builder(Box::new(quests::load_government_quests))
@ -56,10 +56,10 @@ async fn test_set_invalid_quest_group() {
#[async_std::test]
async fn test_get_room_info() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, mut _char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user1, mut _char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
_char1.name = String::from("GODmar");
entity_gateway.save_character(&_char1).await.unwrap();
let (_user2, _char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
let (_user2, _char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
let mut ship = standard_ship(entity_gateway.clone());
log_in_char(&mut ship, ClientId(1), "a1", "a").await;
log_in_char(&mut ship, ClientId(2), "a2", "a").await;
@ -77,8 +77,8 @@ async fn test_get_room_info() {
#[async_std::test]
async fn test_cannot_get_room_info_after_room_is_closed() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, _char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user2, _char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
let (_user1, _char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let (_user2, _char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
let mut ship = standard_ship(entity_gateway.clone());
log_in_char(&mut ship, ClientId(1), "a1", "a").await;
log_in_char(&mut ship, ClientId(2), "a2", "a").await;
@ -97,8 +97,8 @@ async fn test_cannot_get_room_info_after_room_is_closed() {
#[async_std::test]
async fn test_cannot_join_room_after_its_closed() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, _char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user2, _char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
let (_user1, _char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let (_user2, _char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
let mut ship = standard_ship(entity_gateway.clone());
log_in_char(&mut ship, ClientId(1), "a1", "a").await;
log_in_char(&mut ship, ClientId(2), "a2", "a").await;

58
tests/test_shops.rs

@ -17,7 +17,7 @@ use common::*;
async fn test_player_opens_weapon_shop() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
char1.exp = 80000000;
entity_gateway.save_character(&char1).await.unwrap();
@ -47,7 +47,7 @@ async fn test_player_opens_weapon_shop() {
async fn test_player_opens_tool_shop() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
char1.exp = 80000000;
entity_gateway.save_character(&char1).await.unwrap();
@ -77,7 +77,7 @@ async fn test_player_opens_tool_shop() {
async fn test_player_opens_armor_shop() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
char1.exp = 80000000;
entity_gateway.save_character(&char1).await.unwrap();
@ -107,7 +107,7 @@ async fn test_player_opens_armor_shop() {
async fn test_player_buys_from_weapon_shop() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
char1.exp = 80000000;
entity_gateway.save_character(&char1).await.unwrap();
entity_gateway.set_character_meseta(&char1.id, item::Meseta(999999)).await.unwrap();
@ -145,7 +145,7 @@ async fn test_player_buys_from_weapon_shop() {
async fn test_player_buys_from_tool_shop() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
char1.exp = 80000000;
entity_gateway.save_character(&char1).await.unwrap();
entity_gateway.set_character_meseta(&char1.id, item::Meseta(999999)).await.unwrap();
@ -182,7 +182,7 @@ async fn test_player_buys_from_tool_shop() {
async fn test_player_buys_multiple_from_tool_shop() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
char1.exp = 80000000;
entity_gateway.save_character(&char1).await.unwrap();
entity_gateway.set_character_meseta(&char1.id, item::Meseta(999999)).await.unwrap();
@ -223,7 +223,7 @@ async fn test_player_buys_multiple_from_tool_shop() {
async fn test_player_buys_from_armor_shop() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
char1.exp = 80000000;
entity_gateway.save_character(&char1).await.unwrap();
entity_gateway.set_character_meseta(&char1.id, item::Meseta(999999)).await.unwrap();
@ -260,7 +260,7 @@ async fn test_player_buys_from_armor_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", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let mut p1_inv = Vec::new();
@ -302,8 +302,8 @@ async fn test_player_sells_3_attr_weapon_to_shop() {
async fn test_other_clients_see_purchase() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user2, _char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
let (_user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let (_user2, _char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
char1.exp = 80000000;
entity_gateway.set_character_meseta(&char1.id, item::Meseta(999999)).await.unwrap();
entity_gateway.save_character(&char1).await.unwrap();
@ -345,8 +345,8 @@ async fn test_other_clients_see_purchase() {
async fn test_other_clients_see_stacked_purchase() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user2, _char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
let (_user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let (_user2, _char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
char1.exp = 80000000;
entity_gateway.save_character(&char1).await.unwrap();
entity_gateway.set_character_meseta(&char1.id, item::Meseta(999999)).await.unwrap();
@ -396,7 +396,7 @@ async fn test_other_clients_see_stacked_purchase() {
async fn test_buying_item_without_enough_mseseta() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let mut ship = standard_ship(entity_gateway.clone());
log_in_char(&mut ship, ClientId(1), "a1", "a").await;
@ -429,7 +429,7 @@ async fn test_buying_item_without_enough_mseseta() {
async fn test_player_double_buys_from_tool_shop() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
char1.exp = 80000000;
entity_gateway.save_character(&char1).await.unwrap();
entity_gateway.set_character_meseta(&char1.id, item::Meseta(999999)).await.unwrap();
@ -494,7 +494,7 @@ async fn test_player_double_buys_from_tool_shop() {
async fn test_techs_disappear_from_shop_when_bought() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
char1.exp = 80000000;
entity_gateway.save_character(&char1).await.unwrap();
entity_gateway.set_character_meseta(&char1.id, item::Meseta(999999)).await.unwrap();
@ -556,7 +556,7 @@ async fn test_techs_disappear_from_shop_when_bought() {
async fn test_units_disappear_from_shop_when_bought() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
char1.exp = 80000000;
entity_gateway.save_character(&char1).await.unwrap();
entity_gateway.set_character_meseta(&char1.id, item::Meseta(999999)).await.unwrap();
@ -617,7 +617,7 @@ async fn test_units_disappear_from_shop_when_bought() {
async fn test_player_sells_untekked_weapon() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let mut p1_inv = Vec::new();
@ -659,7 +659,7 @@ async fn test_player_sells_untekked_weapon() {
async fn test_player_sells_rare_item() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let mut p1_inv = Vec::new();
@ -701,7 +701,7 @@ async fn test_player_sells_rare_item() {
async fn test_player_sells_partial_photon_drop_stack() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let mut p1_inv = Vec::new();
@ -742,7 +742,7 @@ async fn test_player_sells_partial_photon_drop_stack() {
async fn test_player_sells_basic_frame() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let mut p1_inv = Vec::new();
@ -781,7 +781,7 @@ async fn test_player_sells_basic_frame() {
async fn test_player_sells_max_frame() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let mut p1_inv = Vec::new();
@ -820,7 +820,7 @@ async fn test_player_sells_max_frame() {
async fn test_player_sells_basic_barrier() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let mut p1_inv = Vec::new();
@ -858,7 +858,7 @@ async fn test_player_sells_basic_barrier() {
async fn test_player_sells_max_barrier() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let mut p1_inv = Vec::new();
@ -896,7 +896,7 @@ async fn test_player_sells_max_barrier() {
async fn test_player_sells_1_star_minusminus_unit() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let mut p1_inv = Vec::new();
@ -933,7 +933,7 @@ async fn test_player_sells_1_star_minusminus_unit() {
async fn test_player_sells_5_star_plusplus_unit() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let mut p1_inv = Vec::new();
@ -970,7 +970,7 @@ async fn test_player_sells_5_star_plusplus_unit() {
async fn test_player_sells_rare_frame() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let mut p1_inv = Vec::new();
@ -1009,7 +1009,7 @@ async fn test_player_sells_rare_frame() {
async fn test_player_sells_rare_barrier() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let mut p1_inv = Vec::new();
@ -1047,7 +1047,7 @@ async fn test_player_sells_rare_barrier() {
async fn test_player_sells_rare_unit() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let mut p1_inv = Vec::new();
@ -1084,7 +1084,7 @@ async fn test_player_sells_rare_unit() {
async fn test_player_cant_sell_if_meseta_would_go_over_max() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
entity_gateway.set_character_meseta(&char1.id, item::Meseta(999995)).await.unwrap();
let mut p1_inv = Vec::new();

156
tests/test_trade.rs

@ -113,8 +113,8 @@ impl TradeItemBuilder {
async fn test_trade_one_individual_item() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
let mut p1_inv = Vec::new();
p1_inv.push(entity_gateway.create_item(
@ -212,8 +212,8 @@ async fn test_trade_one_individual_item() {
async fn test_trade_player2_to_player1() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
let mut p2_inv = Vec::new();
p2_inv.push(entity_gateway.create_item(
@ -311,8 +311,8 @@ async fn test_trade_player2_to_player1() {
async fn test_reverse_trade_ack_order() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
let mut p1_inv = Vec::new();
p1_inv.push(entity_gateway.create_item(
@ -410,8 +410,8 @@ async fn test_reverse_trade_ack_order() {
async fn test_trade_one_stacked_item() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
let p1_stack = futures::future::join_all((0..2).map(|_| {
let mut entity_gateway = entity_gateway.clone();
@ -512,8 +512,8 @@ async fn test_trade_one_stacked_item() {
async fn test_trade_partial_stacked_item() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
let p1_stack = futures::future::join_all((0..2).map(|_| {
let mut entity_gateway = entity_gateway.clone();
@ -617,8 +617,8 @@ async fn test_trade_partial_stacked_item() {
async fn test_trade_individual_both() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
let p1_inv = vec![
entity_gateway.create_item(
@ -780,8 +780,8 @@ async fn test_trade_individual_both() {
async fn test_trade_stacked_both() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
let p1_stack = futures::future::join_all((0..2).map(|_| {
let mut entity_gateway = entity_gateway.clone();
@ -948,8 +948,8 @@ async fn test_trade_stacked_both() {
async fn test_trade_partial_stack_both() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
let p1_stack = futures::future::join_all((0..2).map(|_| {
let mut entity_gateway = entity_gateway.clone();
@ -1122,8 +1122,8 @@ async fn test_trade_partial_stack_both() {
async fn test_trade_same_stacked_item_to_eachother() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
let p1_stack = futures::future::join_all((0..3).map(|_| {
let mut entity_gateway = entity_gateway.clone();
@ -1292,8 +1292,8 @@ async fn test_trade_same_stacked_item_to_eachother() {
async fn test_trade_stacked_when_already_have_partial_stack() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
let p1_stack = futures::future::join_all((0..3).map(|_| {
let mut entity_gateway = entity_gateway.clone();
@ -1430,8 +1430,8 @@ async fn test_trade_stacked_when_already_have_partial_stack() {
async fn test_trade_individual_for_stacked() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
let p1_inv = vec![
entity_gateway.create_item(
@ -1598,8 +1598,8 @@ async fn test_trade_individual_for_stacked() {
async fn test_trade_multiple_individual() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
let p1_inv = vec![
entity_gateway.create_item(
@ -1854,8 +1854,8 @@ async fn test_trade_multiple_individual() {
async fn test_trade_multiple_stacked() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
let p1_stack1 = futures::future::join_all((0..2).map(|_| {
let mut entity_gateway = entity_gateway.clone();
@ -2119,8 +2119,8 @@ async fn test_trade_multiple_stacked() {
async fn test_trade_not_enough_inventory_space_individual() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
let p1_inv = futures::future::join_all((0..2).map(|_| {
let mut entity_gateway = entity_gateway.clone();
@ -2240,8 +2240,8 @@ async fn test_trade_not_enough_inventory_space_individual() {
async fn test_trade_not_enough_inventory_space_stacked() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
let p1_stack = futures::future::join_all((0..2).map(|_| {
let mut entity_gateway = entity_gateway.clone();
@ -2355,8 +2355,8 @@ async fn test_trade_not_enough_inventory_space_stacked() {
async fn test_trade_stack_too_big() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
let p1_stack = futures::future::join_all((0..8).map(|_| {
let mut entity_gateway = entity_gateway.clone();
@ -2469,8 +2469,8 @@ async fn test_trade_stack_too_big() {
async fn test_trade_meseta() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
entity_gateway.set_character_meseta(&char1.id, Meseta(2323)).await.unwrap();
@ -2548,8 +2548,8 @@ async fn test_trade_meseta() {
async fn test_trade_too_much_meseta() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
entity_gateway.set_character_meseta(&char1.id, Meseta(4000)).await.unwrap();
entity_gateway.set_character_meseta(&char2.id, Meseta(999000)).await.unwrap();
@ -2598,8 +2598,8 @@ async fn test_trade_too_much_meseta() {
async fn test_trade_invalid_amount_of_meseta() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
entity_gateway.set_character_meseta(&char1.id, Meseta(4000)).await.unwrap();
entity_gateway.set_character_meseta(&char2.id, Meseta(999000)).await.unwrap();
@ -2648,8 +2648,8 @@ async fn test_trade_invalid_amount_of_meseta() {
async fn test_trade_meseta_request_and_items_dont_match() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
entity_gateway.set_character_meseta(&char1.id, Meseta(4000)).await.unwrap();
entity_gateway.set_character_meseta(&char2.id, Meseta(999000)).await.unwrap();
@ -2698,8 +2698,8 @@ async fn test_trade_meseta_request_and_items_dont_match() {
async fn test_player_declined_trade() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, _char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user2, _char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
let (_user1, _char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let (_user2, _char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
let mut ship = standard_ship(entity_gateway.clone());
log_in_char(&mut ship, ClientId(1), "a1", "a").await;
@ -2727,8 +2727,8 @@ async fn test_player_declined_trade() {
async fn test_back_out_of_trade_last_minute() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
let mut p1_inv = Vec::new();
p1_inv.push(entity_gateway.create_item(
@ -2791,8 +2791,8 @@ async fn test_back_out_of_trade_last_minute() {
async fn test_valid_trade_when_both_inventories_are_full() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
let p1_inv = futures::future::join_all((0..30).map(|_| {
let mut entity_gateway = entity_gateway.clone();
@ -2931,8 +2931,8 @@ async fn test_valid_trade_when_both_inventories_are_full() {
async fn test_invalid_trade_when_both_inventories_are_full() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
let p1_inv = futures::future::join_all((0..30).map(|_| {
let mut entity_gateway = entity_gateway.clone();
@ -3081,9 +3081,9 @@ async fn test_invalid_trade_when_both_inventories_are_full() {
async fn test_client_tries_to_start_two_trades() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, _char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user2, _char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
let (_user2, _char3) = new_user_character(&mut entity_gateway, "a3", "a", 1).await;
let (_user1, _char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let (_user2, _char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
let (_user2, _char3) = new_user_character(&mut entity_gateway, "a3", "a").await;
let mut ship = standard_ship(entity_gateway.clone());
log_in_char(&mut ship, ClientId(1), "a1", "a").await;
@ -3112,9 +3112,9 @@ async fn test_client_tries_to_start_two_trades() {
async fn test_client_tries_trading_with_client_already_trading() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, _char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user2, _char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
let (_user2, _char3) = new_user_character(&mut entity_gateway, "a3", "a", 1).await;
let (_user1, _char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let (_user2, _char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
let (_user2, _char3) = new_user_character(&mut entity_gateway, "a3", "a").await;
let mut ship = standard_ship(entity_gateway.clone());
log_in_char(&mut ship, ClientId(1), "a1", "a").await;
@ -3149,8 +3149,8 @@ async fn test_client_tries_trading_with_client_already_trading() {
async fn test_add_then_remove_individual_item() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
let mut p1_inv = Vec::new();
for _ in 0..2 {
@ -3260,8 +3260,8 @@ async fn test_add_then_remove_individual_item() {
async fn test_add_then_remove_stacked_item() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
let p1_stack1 = futures::future::join_all((0..2).map(|_| {
let mut entity_gateway = entity_gateway.clone();
@ -3393,8 +3393,8 @@ async fn test_add_then_remove_stacked_item() {
async fn test_add_then_remove_partial_stack() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
let p1_stack1 = futures::future::join_all((0..2).map(|_| {
let mut entity_gateway = entity_gateway.clone();
@ -3515,8 +3515,8 @@ async fn test_add_then_remove_partial_stack() {
async fn test_add_then_remove_meseta() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
entity_gateway.set_character_meseta(&char1.id, Meseta(2323)).await.unwrap();
@ -3599,8 +3599,8 @@ async fn test_add_then_remove_meseta() {
async fn test_items_to_trade_data_does_not_match() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
let mut p1_inv = Vec::new();
p1_inv.push(entity_gateway.create_item(
@ -3680,8 +3680,8 @@ async fn test_items_to_trade_data_does_not_match() {
async fn test_items_to_trade_id_does_not_match() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
let mut p1_inv = Vec::new();
p1_inv.push(entity_gateway.create_item(
@ -3749,8 +3749,8 @@ async fn test_items_to_trade_id_does_not_match() {
async fn test_stack_is_same_amount_in_request_and_items_to_trade() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
let p1_stack = futures::future::join_all((0..2).map(|_| {
let mut entity_gateway = entity_gateway.clone();
@ -3821,8 +3821,8 @@ async fn test_stack_is_same_amount_in_request_and_items_to_trade() {
async fn test_stack_is_same_amount_in_request_and_items_to_trade2() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
let p1_stack = futures::future::join_all((0..2).map(|_| {
let mut entity_gateway = entity_gateway.clone();
@ -3893,8 +3893,8 @@ async fn test_stack_is_same_amount_in_request_and_items_to_trade2() {
async fn test_items_to_trade_count_less_than() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
let p1_inv = vec![
entity_gateway.create_item(
@ -3993,8 +3993,8 @@ async fn test_items_to_trade_count_less_than() {
async fn test_items_to_trade_count_greater_than() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
entity_gateway.set_character_meseta(&char1.id, Meseta(23)).await.unwrap();
@ -4101,8 +4101,8 @@ async fn test_items_to_trade_count_greater_than() {
async fn test_items_to_trade_count_mismatch_with_meseta() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
let p1_inv = vec![
entity_gateway.create_item(
@ -4201,8 +4201,8 @@ async fn test_items_to_trade_count_mismatch_with_meseta() {
async fn test_dropping_item_after_trade() {
let mut entity_gateway = InMemoryGateway::default();
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
let mut p1_inv = Vec::new();
p1_inv.push(entity_gateway.create_item(

Loading…
Cancel
Save