import { makeAppObjectRepo } from "@vived/core";
import { makeStickableEntity } from "../Entities/Stickable";
import { makeStickTargetPM, StickTargetPM, } from "./StickTargetPM";
function makeTestRig() {
    const appObjects = makeAppObjectRepo();
    const ao = appObjects.getOrCreate("AO");
    const stickable = makeStickableEntity(ao);
    const pm = 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.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