You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
966 B

4 years ago
4 years ago
4 years ago
  1. use elseware::common::serverstate::{ClientId, ServerState};
  2. use elseware::entity::gateway::{EntityGateway, InMemoryGateway};
  3. use elseware::ship::ship::{ShipServerState, RecvShipPacket};
  4. use libpso::packet::ship::*;
  5. #[path = "common.rs"]
  6. mod common;
  7. use common::*;
  8. #[async_std::test]
  9. async fn test_save_options() {
  10. let mut entity_gateway = InMemoryGateway::new();
  11. let (user1, _char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
  12. let mut ship = ShipServerState::builder()
  13. .gateway(entity_gateway.clone())
  14. .build();
  15. log_in_char(&mut ship, ClientId(1), "a1", "a").await;
  16. join_lobby(&mut ship, ClientId(1)).await;
  17. ship.handle(ClientId(1), &RecvShipPacket::SaveOptions(SaveOptions{
  18. options: 12345,
  19. })).await.unwrap().for_each(drop);
  20. let characters = entity_gateway.get_characters_by_user(&user1).await;
  21. let char = characters[0].as_ref().unwrap();
  22. assert!(char.option_flags == 12345);
  23. }