use elseware::common::serverstate::{ClientId, ServerState}; use elseware::entity::gateway::{EntityGateway, InMemoryGateway}; use elseware::ship::ship::{ShipServerState, RecvShipPacket}; use libpso::packet::ship::*; #[path = "common.rs"] mod common; use common::*; #[async_std::test] async fn test_save_options(ship: &mut ShipServerState, id: ClientId, options: u32) { let mut entity_gateway = InMemoryGateway::new(); let (user1, _char1) = new_user_character(&mut entity_gateway, "a1", "a").await; let mut ship = ShipServerState::builder() .gateway(entity_gateway.clone()) .build(); log_in_char(&mut ship, ClientId(1), "a1", "a").await; join_lobby(&mut ship, ClientId(1)).await; ship.handle(ClientId(1), &RecvShipPacket::SaveOptions(SaveOptions{ options: 12345, })).await.unwrap().for_each(drop); let characters = entity_gateway.get_characters_by_user(&user1).await; let char = characters[0].as_ref().unwrap(); assert!(char.option_flags == 12345); }