/*!
 * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
 * Licensed under the MIT License.
 */
import { FieldKinds, cursorForJsonableTreeNode, } from "../../feature-libraries/index.js";
import { brand } from "../../util/index.js";
import { leaf } from "../../domains/index.js";
// TODO: Users of this are mainly working with in memory representations.
// Therefore it should not be using JsonableTrees.
// The usages of this (and other JsonableTrees) such as ValueChangeset should be changed to use
// a tree format intended for in memory use, such as Cursor or MapTree.
/**
 * Arbitrary tree with value `s`
 */
export function testTree(s) {
    return { type: leaf.string.name, value: s };
}
/**
 * Cursor over arbitrary tree with value `s`
 */
export function testTreeCursor(s) {
    // For encoding tests to pass, cursors must be deepEqual to those produced by decode, so the tree text format must be used here.
    return cursorForJsonableTreeNode(testTree(s));
}
export const fooKey = brand("foo");
/**
 * Create a NodeChangeset with a child change to the foo field.
 */
export function changesetForChild(change) {
    return {
        fieldChanges: new Map([
            [
                fooKey,
                {
                    fieldKind: FieldKinds.optional.identifier,
                    change: brand(change),
                },
            ],
        ]),
    };
}
//# sourceMappingURL=fieldKindTestUtils.js.map