Skip to content

Commit

Permalink
add failing test case for colyseus/colyseus#561
Browse files Browse the repository at this point in the history
  • Loading branch information
endel committed Jul 23, 2023
1 parent 185e332 commit 9abe3e4
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/ChangeTreeTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,19 @@ import { ChangeTree } from "../src/changes/ChangeTree";
import { Schema, type, MapSchema, ArraySchema } from "../src";

describe("ChangeTree", () => {
xit("should not error when updating a detached structure", async () => {
class Player extends Schema {
@type("number") pos: number = 0;
}
class State extends Schema {
@type({ map: Player }) players = new MapSchema<Player>();
}
const state = new State();
// @ts-ignore
state.players.set(3, new Player());
assert.doesNotThrow(() => state.encodeAll());
});

it("instances should share parent/root references", () => {
class Skill extends Schema {
@type("number") damage: number;
Expand Down

0 comments on commit 9abe3e4

Please sign in to comment.