fix: handle edge object in serialization tests
Add `typecheck` script to package.json, expand tsconfig include paths to cover tests and examples, and update serialization tests to correctly resolve player IDs from relationship edges.
This commit is contained in:
parent
cd6350e0b1
commit
365b2c4d13
|
|
@ -29,6 +29,7 @@
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "tsup",
|
"build": "tsup",
|
||||||
"dev": "tsup --watch",
|
"dev": "tsup --watch",
|
||||||
|
"typecheck": "tsc --noEmit",
|
||||||
"test": "vitest run",
|
"test": "vitest run",
|
||||||
"prepublishOnly": "npm run build"
|
"prepublishOnly": "npm run build"
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -277,7 +277,9 @@ describe("Serialization — complex state", () => {
|
||||||
const comps = snap.entities[id];
|
const comps = snap.entities[id];
|
||||||
return comps.position && comps.velocity && !comps.health;
|
return comps.position && comps.velocity && !comps.health;
|
||||||
})!;
|
})!;
|
||||||
const playerId = snap.relationships.ownedBy[bulletId];
|
const playerEdge = snap.relationships.ownedBy[bulletId];
|
||||||
|
const playerId =
|
||||||
|
typeof playerEdge === "string" ? playerEdge : playerEdge.target;
|
||||||
|
|
||||||
// Player should have a name
|
// Player should have a name
|
||||||
const playerComps = snap.entities[playerId];
|
const playerComps = snap.entities[playerId];
|
||||||
|
|
|
||||||
|
|
@ -11,8 +11,7 @@
|
||||||
"declarationMap": true,
|
"declarationMap": true,
|
||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
"outDir": "./dist",
|
"outDir": "./dist",
|
||||||
"rootDir": "./src"
|
|
||||||
},
|
},
|
||||||
"include": ["src"],
|
"include": ["src", "test", "examples"],
|
||||||
"exclude": ["node_modules", "dist"]
|
"exclude": ["node_modules", "dist"],
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue