/*!
 * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
 * Licensed under the MIT License.
 */
import { strict as assert } from "assert";
import { mapCursorField, rootFieldKey, } from "../../../core/index.js";
import { leaf } from "../../../domains/index.js";
import { jsonableTreeFromCursor } from "../../../feature-libraries/index.js";
import { checkFieldTraversal } from "../../cursorTestSuite.js";
export function jsonableTreesFromFieldCursor(cursor) {
    return mapCursorField(cursor, jsonableTreeFromCursor);
}
export function numberSequenceField(length) {
    const field = [];
    for (let index = 0; index < length; index++) {
        field.push({ type: leaf.number.name, value: index });
    }
    return field;
}
export function assertChunkCursorEquals(chunk, expected) {
    const result = jsonableTreesFromFieldCursor(chunk.cursor());
    assert.deepEqual(result, expected);
    assert.equal(chunk.topLevelLength, expected.length);
}
export function assertChunkCursorBatchEquals(chunk, expected) {
    assert.equal(chunk.length, expected.length);
    for (let index = 0; index < chunk.length; index++) {
        assertChunkCursorEquals(chunk[index], expected[index]);
    }
}
export function validateChunkCursor(chunk, expected, expectedPath = {
    field: rootFieldKey,
    parent: undefined,
}) {
    checkFieldTraversal(chunk.cursor(), expectedPath);
    assertChunkCursorEquals(chunk, expected);
}
//# sourceMappingURL=fieldCursorTestUtilities.js.map