Skip to content

Commit

Permalink
Remove DummyComponent from server event tests
Browse files Browse the repository at this point in the history
It's unnecessary. Spawning any replicated entity is enough to trigger the world change.
  • Loading branch information
Shatur committed Sep 3, 2024
1 parent 10c35e3 commit 635fafc
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions tests/server_event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,14 +206,13 @@ fn event_queue() {
..Default::default()
}),
))
.replicate::<DummyComponent>()
.add_server_event::<DummyEvent>(ChannelKind::Ordered);
}

server_app.connect_client(&mut client_app);

// Spawn entity to trigger world change.
server_app.world_mut().spawn((Replicated, DummyComponent));
server_app.world_mut().spawn(Replicated);

server_app.update();
server_app.exchange_with_client(&mut client_app);
Expand Down Expand Up @@ -316,15 +315,14 @@ fn independent() {
..Default::default()
}),
))
.replicate::<DummyComponent>()
.add_server_event::<DummyEvent>(ChannelKind::Ordered)
.make_independent::<DummyEvent>();
}

server_app.connect_client(&mut client_app);

// Spawn entity to trigger world change.
server_app.world_mut().spawn((Replicated, DummyComponent));
server_app.world_mut().spawn(Replicated);

server_app.update();
server_app.exchange_with_client(&mut client_app);
Expand Down Expand Up @@ -380,14 +378,13 @@ fn before_started_replication() {
..Default::default()
}),
))
.replicate::<DummyComponent>()
.add_server_event::<DummyEvent>(ChannelKind::Ordered);
}

server_app.connect_client(&mut client_app);

// Spawn entity to trigger world change.
server_app.world_mut().spawn((Replicated, DummyComponent));
server_app.world_mut().spawn(Replicated);

server_app.world_mut().send_event(ToClients {
mode: SendMode::Broadcast,
Expand Down Expand Up @@ -416,15 +413,14 @@ fn independent_before_started_replication() {
..Default::default()
}),
))
.replicate::<DummyComponent>()
.add_server_event::<DummyEvent>(ChannelKind::Ordered)
.make_independent::<DummyEvent>();
}

server_app.connect_client(&mut client_app);

// Spawn entity to trigger world change.
server_app.world_mut().spawn((Replicated, DummyComponent));
server_app.world_mut().spawn(Replicated);

server_app.world_mut().send_event(ToClients {
mode: SendMode::Broadcast,
Expand Down Expand Up @@ -452,15 +448,14 @@ fn different_ticks() {
..Default::default()
}),
))
.replicate::<DummyComponent>()
.add_server_event::<DummyEvent>(ChannelKind::Ordered);
}

// Connect client 1 first.
server_app.connect_client(&mut client_app1);

// Spawn entity to trigger world change.
server_app.world_mut().spawn((Replicated, DummyComponent));
server_app.world_mut().spawn(Replicated);

// Update client 1 to initialize their replicon tick.
server_app.update();
Expand Down Expand Up @@ -495,9 +490,6 @@ fn different_ticks() {
);
}

#[derive(Component, Serialize, Deserialize)]
struct DummyComponent;

#[derive(Deserialize, Event, Serialize)]
struct DummyEvent;

Expand Down

0 comments on commit 635fafc

Please sign in to comment.