/*!
 * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
 * Licensed under the MIT License.
 */
import { SchemaFactory } from "../../simple-tree/index.js";
import { TreeFactory } from "../../treeFactory.js";
const schema = new SchemaFactory("com.example");
const factory = new TreeFactory({});
describe("schemaTypes", () => {
    it("TreeNode", () => {
        // @ts-expect-error TreeNode should not allow non-node objects.
        const n = {};
    });
    describe("insertable", () => {
        it("Lists", () => {
            const List = schema.array(schema.number);
            const NestedList = schema.array(List);
            const list = [5];
            const nestedList = [[5]];
            // Not nested
            {
            }
            // Not nested
            {
            }
            // Nested
            {
            }
            // Regression test for InsertableTypedNode not distributing over unions correctly.
            {
                const x = [];
            }
        });
        it("Objects", () => {
            const A = schema.object("A", {});
            const B = schema.object("B", { a: A });
            const a = new A({});
            const b = new B({ a });
            const b2 = new B({ a: {} });
            // @ts-expect-error empty nodes should not allow non objects.
            const a2 = 0;
            // @ts-expect-error empty nodes should not allow non objects.
            const a3 = 0;
            // @ts-expect-error empty nodes should not allow non-node.
            const a4 = {};
            // Insertable nodes allow non-node objects.
            const a5 = {};
        });
        it("Customized Objects", () => {
            class A extends schema.object("A", {}) {
                constructor() {
                    super(...arguments);
                    this.extra = 0;
                }
            }
            class B extends schema.object("B", { a: A }) {
                constructor() {
                    super(...arguments);
                    this.extra = "";
                }
            }
            const a = new A({});
            const b = new B({ a });
            const b2 = new B({ a: {} });
        });
        it("Mixed Regression test", () => {
            class Note extends schema.object("Note", {}) {
                constructor() {
                    super(...arguments);
                    this.isSelected = false;
                }
            }
            class NodeMap extends schema.map("NoteMap", Note) {
            }
            class NodeList extends schema.array("NoteList", Note) {
            }
            class Canvas extends schema.object("Canvas", { stuff: [NodeMap, NodeList] }) {
            }
            const y = new NodeList([{}]);
            // There was a bug where unions with maps lost implicit contractibility, causing this to not compile:
            const x = new Canvas({
                stuff: [{}],
            });
        });
    });
    it("TreeLeafValue", () => {
    });
});
//# sourceMappingURL=schemaTypes.spec.js.map