Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion packages/dds/tree/src/test/shared-tree/sharedTree.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2359,7 +2359,7 @@ describe("SharedTree", () => {
});

describe("Identifiers", () => {
it("Can use identifiers and the static Tree Apis", () => {
it("can use identifiers and the static Tree Apis", () => {
const sf = new SchemaFactory("com.example");
class Widget extends sf.object("Widget", { id: sf.identifier }) {}

Expand All @@ -2377,6 +2377,27 @@ describe("SharedTree", () => {
assert.equal(typeof Tree.shortId(widget), "number");
assert.equal(Tree.shortId(fidget), "fidget");
});

it.only("synchronizes correctly", async () => {
const provider = await TestTreeProvider.create(2);

const sf = new SchemaFactory("com.example")

class Widget extends sf.object("Widget", {id: sf.identifier}) {}

// Apply an edit to the first tree which inserts a node with a value
const view = provider.trees[0].viewWith(
new TreeViewConfiguration({
schema: Widget,
enableSchemaValidation,
}),
);
view.initialize({});

// Ensure that the second tree receives the expected state from the first tree
await provider.ensureSynchronized();
validateTreeConsistency(provider.trees[0], provider.trees[1]);
});
});

describe("Schema validation", () => {
Expand Down
Loading