"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("@vived/core");
const HoverLabelEntity_1 = require("../Entities/HoverLabelEntity");
const AllowHoverLabelPM_1 = require("./AllowHoverLabelPM");
function makeTestRig() {
    const appObjects = (0, core_1.makeAppObjectRepo)();
    const registerSpy = jest.spyOn(appObjects, "registerSingleton");
    const appObject = appObjects.getOrCreate("AppObject");
    const hoverLabel = (0, HoverLabelEntity_1.makeHoverLabelEntity)(appObject);
    const view = jest.fn();
    const pm = (0, AllowHoverLabelPM_1.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_1.AllowHoverLabelPM.get(appObjects)).toEqual(pm);
    });
    it("Registers as the singleton", () => {
        const { pm, registerSpy } = makeTestRig();
        expect(registerSpy).toHaveBeenCalledWith(pm);
    });
});
//# sourceMappingURL=AllowHoverLabelPM.test.js.map