aboutsummaryrefslogtreecommitdiff
path: root/azalea-client/tests/simulation/client_disconnect.rs
blob: 60f112c2a2134891eb667bb41dad40cc28d98218 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
use azalea_client::test_utils::prelude::*;
use azalea_protocol::packets::ConnectionProtocol;
use azalea_world::WorldName;

#[test]
fn test_client_disconnect() {
    let _lock = init();

    let mut simulation = Simulation::new(ConnectionProtocol::Game);

    simulation.disconnect();
    simulation.tick();

    // make sure we're disconnected
    let is_connected = simulation.has_component::<WorldName>();
    assert!(!is_connected);

    // tick again to make sure nothing goes wrong
    simulation.tick();
}