"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("@vived/core");
const Stickable_1 = require("../Entities/Stickable");
const StickTargetPM_1 = require("./StickTargetPM");
function makeTestRig() {
    const appObjects = (0, core_1.makeAppObjectRepo)();
    const ao = appObjects.getOrCreate("AO");
    const stickable = (0, Stickable_1.makeStickableEntity)(ao);
    const pm = (0, StickTargetPM_1.makeStickTargetPM)(ao);
    return { appObjects, pm, stickable };
}
describe("Stick Target Presentation Manager", () => {
    it("Initializes the view", () => {
        const { pm } = makeTestRig();
        expect(pm.lastVM).not.toBeUndefined();
    });
    it("Gets the PM", () => {
        const { pm, appObjects } = makeTestRig();
        expect(StickTargetPM_1.StickTargetPM.get("AO", appObjects)).toEqual(pm);
    });
    it("Checks for equal VMs", () => {
        const { pm } = makeTestRig();
        const vm1 = {
            highlightTarget: false,
            showStickTarget: false,
        };
        const vm2 = { ...vm1 };
        expect(pm.vmsAreEqual(vm1, vm2)).toEqual(true);
    });
    it("Checks for a change in the highlightTarget flag", () => {
        const { pm } = makeTestRig();
        const vm1 = {
            highlightTarget: false,
            showStickTarget: false,
        };
        const vm2 = { ...vm1, highlightTarget: true };
        expect(pm.vmsAreEqual(vm1, vm2)).toEqual(false);
    });
    it("Checks for a change in the showStickTarget flag", () => {
        const { pm } = makeTestRig();
        const vm1 = {
            highlightTarget: false,
            showStickTarget: false,
        };
        const vm2 = { ...vm1, showStickTarget: true };
        expect(pm.vmsAreEqual(vm1, vm2)).toEqual(false);
    });
    it("Sets the showStickTarget flag", () => {
        const { pm, stickable } = makeTestRig();
        stickable.showStickTarget = true;
        expect(pm.lastVM?.showStickTarget).toEqual(true);
        stickable.showStickTarget = false;
        expect(pm.lastVM?.showStickTarget).toEqual(false);
    });
    it("Sets the highlightTarget flag", () => {
        const { pm, stickable } = makeTestRig();
        stickable.highlightTarget = true;
        expect(pm.lastVM?.highlightTarget).toEqual(true);
        stickable.highlightTarget = false;
        expect(pm.lastVM?.highlightTarget).toEqual(false);
    });
});
//# sourceMappingURL=StickTargetPM.test.js.map