|
|
@ -0,0 +1,55 @@ |
|
|
|
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_guildcard_add_friend() {
|
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
|
let (user1, _char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
// Accept friend request from "Test Char 2"
|
|
|
|
ship.handle(ClientId(1), &RecvShipPacket::GuildcardAccept(GuildcardAccept {
|
|
|
|
id: 2,
|
|
|
|
name: [84, 101, 115, 116, 32, 67, 104, 97, 114, 32, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
|
|
|
team: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
|
|
|
desc: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
|
|
|
one: 1,
|
|
|
|
language: 0,
|
|
|
|
section_id: 0,
|
|
|
|
class: 0,
|
|
|
|
})).await.unwrap().for_each(drop);
|
|
|
|
|
|
|
|
let friendlist = entity_gateway.get_guild_card_data_by_user(&user1).await.unwrap();
|
|
|
|
|
|
|
|
assert!(friendlist.guildcard_data.friends[0].name == [84, 101, 115, 116, 32, 67, 104, 97, 114, 32, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
TODO: actually write these tests at some point. also add a test for transmute/repr(C)?
|
|
|
|
|
|
|
|
#[async_std::test]
|
|
|
|
async fn test_guildcard_block_rival() {}
|
|
|
|
|
|
|
|
#[async_std::test]
|
|
|
|
async fn test_guildcard_write_comment() {}
|
|
|
|
|
|
|
|
#[async_std::test]
|
|
|
|
async fn test_player_chat() {}
|
|
|
|
|
|
|
|
#[async_std::test]
|
|
|
|
async fn test_update_infoboard() {}
|
|
|
|
|
|
|
|
*/
|