import { makeAppObjectRepo } from "@vived/core";
import { makeHoverLabelEntity } from "../Entities/HoverLabelEntity";
import { AllowHoverLabelPM, makeAllowHoverLabelPM } from "./AllowHoverLabelPM";
function makeTestRig() {
    const appObjects = makeAppObjectRepo();
    const registerSpy = jest.spyOn(appObjects, "registerSingleton");
    const appObject = appObjects.getOrCreate("AppObject");
    const hoverLabel = makeHoverLabelEntity(appObject);
    const view = jest.fn();
    const pm = makeAllowHoverLabelPM(appObject);
    pm.addView(view);
    return { hoverLabel, view, pm, registerSpy, appObjects };
}
describe("Allow Hover Label Presentation Manager", () => {
    it("Sets the last vm on construction", () => {
        const { pm } = makeTestRig();
        expect(pm.lastVM).not.toBeUndefined();
    });
    it("Updates the view when the allow hover label is changed", () => {
        const { view, hoverLabel } = makeTestRig();
        view.mockClear();
        hoverLabel.allowHoverLabel = false;
        expect(view).toHaveBeenCalledWith(false);
    });
    it("Returns true if the VMs are the same", () => {
        const { pm } = makeTestRig();
        const vm1 = true;
        const vm2 = true;
        expect(pm.vmsAreEqual(vm1, vm2)).toEqual(true);
    });
    it("Returns false if an object is added", () => {
        const { pm } = makeTestRig();
        const vm1 = true;
        const vm2 = false;
        expect(pm.vmsAreEqual(vm1, vm2)).toEqual(false);
    });
    it("Gets the PM", () => {
        const { pm, appObjects } = makeTestRig();
        expect(AllowHoverLabelPM.get(appObjects)).toEqual(pm);
    });
    it("Registers as the singleton", () => {
        const { pm, registerSpy } = makeTestRig();
        expect(registerSpy).toHaveBeenCalledWith(pm);
    });
});
//# sourceMappingURL=AllowHoverLabelPM.test.js.map