test: add missing types to serialization tests
This commit is contained in:
@@ -5,8 +5,11 @@ import {
|
||||
defineRelationship,
|
||||
type WorldSnapshot,
|
||||
query,
|
||||
type QueryUpdate,
|
||||
type RelationshipUpdate,
|
||||
type WorldEvent,
|
||||
type ComponentDef,
|
||||
type RelationshipDef,
|
||||
} from "../src/index";
|
||||
|
||||
// ── Definitions ─────────────────────────────────────
|
||||
@@ -24,8 +27,15 @@ const OwnedBy = defineRelationship("ownedBy");
|
||||
// ── Serialization helpers ────────────────────────────
|
||||
function roundTrip(
|
||||
world: World,
|
||||
components = [Position, Velocity, Health, Shield, Name, Team],
|
||||
rels = [ChildOf, Targeting, OwnedBy],
|
||||
components: ComponentDef<any>[] = [
|
||||
Position,
|
||||
Velocity,
|
||||
Health,
|
||||
Shield,
|
||||
Name,
|
||||
Team,
|
||||
],
|
||||
rels: RelationshipDef[] = [ChildOf, Targeting, OwnedBy],
|
||||
): World {
|
||||
const json = JSON.stringify(world.toJSON());
|
||||
return World.fromJSON(JSON.parse(json), components, rels);
|
||||
|
||||
Reference in New Issue
Block a user