aboutsummaryrefslogtreecommitdiff
path: root/azalea-client/tests/simulation/fast_login.rs
diff options
context:
space:
mode:
authormat <git@matdoes.dev>2025-12-22 21:43:54 -1400
committermat <git@matdoes.dev>2025-12-22 21:43:54 -1400
commit82e3d46ca319badcbc584cf902aeebcbd30948b9 (patch)
tree4afb8c6135caacbdf9f1f04d451cb2bae1c488b6 /azalea-client/tests/simulation/fast_login.rs
parent0429a81d706da7c45600d357f9f9a14cef6113b4 (diff)
downloadazalea-drasl-82e3d46ca319badcbc584cf902aeebcbd30948b9.tar.xz
run azalea-client integration tests as one binary
per https://corrode.dev/blog/tips-for-faster-rust-compile-times/\#combine-all-integration-tests-into-a-single-binary <3
Diffstat (limited to 'azalea-client/tests/simulation/fast_login.rs')
-rw-r--r--azalea-client/tests/simulation/fast_login.rs42
1 files changed, 42 insertions, 0 deletions
diff --git a/azalea-client/tests/simulation/fast_login.rs b/azalea-client/tests/simulation/fast_login.rs
new file mode 100644
index 00000000..270f4464
--- /dev/null
+++ b/azalea-client/tests/simulation/fast_login.rs
@@ -0,0 +1,42 @@
+use azalea_client::{InConfigState, test_utils::prelude::*};
+use azalea_entity::metadata::Health;
+use azalea_protocol::packets::{
+ ConnectionProtocol,
+ config::{ClientboundFinishConfiguration, ClientboundRegistryData},
+ game::ClientboundSetHealth,
+};
+use azalea_registry::identifier::Identifier;
+use simdnbt::owned::{NbtCompound, NbtTag};
+
+#[test]
+fn test_fast_login() {
+ let _lock = init();
+
+ let mut simulation = Simulation::new(ConnectionProtocol::Configuration);
+ assert!(simulation.has_component::<InConfigState>());
+
+ simulation.receive_packet(ClientboundRegistryData {
+ registry_id: Identifier::new("minecraft:dimension_type"),
+ entries: vec![(
+ Identifier::new("minecraft:overworld"),
+ Some(NbtCompound::from_values(vec![
+ ("height".into(), NbtTag::Int(384)),
+ ("min_y".into(), NbtTag::Int(-64)),
+ ])),
+ )]
+ .into_iter()
+ .collect(),
+ });
+
+ simulation.receive_packet(ClientboundFinishConfiguration);
+ // note that there's no simulation tick here
+ simulation.receive_packet(ClientboundSetHealth {
+ health: 15.,
+ food: 20,
+ saturation: 20.,
+ });
+ simulation.tick();
+ // we need a second tick to handle the state switch properly
+ simulation.tick();
+ assert_eq!(*simulation.component::<Health>(), 15.);
+}