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