"use strict";
/*!
 * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
 * Licensed under the MIT License.
 */
Object.defineProperty(exports, "__esModule", { value: true });
const node_assert_1 = require("node:assert");
const attributionPolicy_js_1 = require("../attributionPolicy.js");
const testClient_js_1 = require("./testClient.js");
const localUserLongId = "localUser";
describe("createInsertOnlyAttributionPolicy", () => {
    let client;
    let seq = 0;
    beforeEach(() => {
        client = new testClient_js_1.TestClient({
            attribution: {
                track: true,
                policyFactory: attributionPolicy_js_1.createInsertOnlyAttributionPolicy,
            },
        });
        seq = 0;
    });
    it("Attributes content on insert", () => {
        client.startOrUpdateCollaboration(localUserLongId);
        client.applyMsg(client.makeOpMessage(client.insertTextLocal(0, "ABC"), ++seq, seq - 1));
        node_assert_1.strict.deepEqual(client.getAllAttributionSeqs(), [1, 1, 1]);
    });
    it("Attributes content inserted before starting collaboration with a detached key", () => {
        client.insertTextLocal(0, "C");
        client.startOrUpdateCollaboration(localUserLongId);
        client.applyMsg(client.makeOpMessage(client.insertTextLocal(0, "AB"), ++seq, seq - 1));
        node_assert_1.strict.deepEqual(client.getAllAttributionSeqs(), [1, 1, { type: "detached", id: 0 }]);
    });
});
//# sourceMappingURL=createInsertOnlyAttributionPolicy.spec.js.map