Commit 452acee
committed
test(ecs): pass the required onChangeFunction, and pin it with an inbound message
Correctness review of this branch found the only certain defects on it were
inside its own regression test.
The two `Engine({ entityContainer })` calls omitted `onChangeFunction`, which
IEngineOptions declares as required. That is not cosmetic: engine/index.ts:310
is `options?.onChangeFunction(...)` — the optional chain guards `options`, not
the member — so with a partial options object the call is `undefined(...)`.
Those engines threw on their first inbound message. Every test in both blocks
passed because none of them ticked.
Verified directly:
WITH onChangeFunction -> update() resolved, component landed
WITHOUT onChangeFunction -> update() THREW: options?.onChangeFunction is not a function
no options at all -> update() resolved (the optional chain short-circuits)
Added a test per block that feeds a real inbound PUT through a transport,
because `onChangeFunction` is only invoked from the CRDT receive path — a bare
update() with no transport never reaches it, so my first two attempts at this
test were vacuous. Negative control: removing the option now fails 1 of 26 with
that TypeError.
Also rewrote the setup comment above the recycling block. It claimed the avatar
tombstone had to be recorded before any recyclable scene number "or the avatar
key is never reached" — true against an unfixed container, but on this branch
`updateRemovedEntity` refuses the tombstone outright, so `removedEntities` never
holds that key and the loop guard is never consulted. The tests were passing for
a different reason than the comment gave. Now says what the setup is actually
for: making them discriminate against unfixed source.1 parent 3d4c50d commit 452acee
1 file changed
Lines changed: 39 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
10 | 12 | | |
11 | 13 | | |
12 | 14 | | |
| |||
28 | 30 | | |
29 | 31 | | |
30 | 32 | | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
37 | 41 | | |
38 | 42 | | |
39 | 43 | | |
40 | 44 | | |
41 | 45 | | |
42 | | - | |
| 46 | + | |
43 | 47 | | |
44 | 48 | | |
45 | 49 | | |
| |||
192 | 196 | | |
193 | 197 | | |
194 | 198 | | |
195 | | - | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
196 | 203 | | |
197 | 204 | | |
198 | 205 | | |
| |||
214 | 221 | | |
215 | 222 | | |
216 | 223 | | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
217 | 244 | | |
218 | 245 | | |
219 | 246 | | |
220 | 247 | | |
221 | 248 | | |
222 | 249 | | |
223 | | - | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
224 | 254 | | |
225 | 255 | | |
226 | 256 | | |
| |||
0 commit comments