"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("@vived/core");
const CalloutEntity_1 = require("../Entities/CalloutEntity");
const CalloutSizePM_1 = require("./CalloutSizePM");
function makeTestRig() {
    const appObjects = (0, core_1.makeAppObjectRepo)();
    const appObj = appObjects.getOrCreate("appObj");
    const ao = appObjects.getOrCreate("callout");
    const callout = (0, CalloutEntity_1.makeCalloutEntity)(ao);
    const pm = (0, CalloutSizePM_1.makeCalloutSizePM)(ao);
    const view = jest.fn();
    pm.addView(view);
    return { appObj, appObjects, pm, view, callout };
}
describe("Callout Size Presentation Manager", () => {
    it("Gets the PM", () => {
        const { appObjects, pm } = makeTestRig();
        expect(CalloutSizePM_1.CalloutSizePM.get("callout", appObjects)).toEqual(pm);
    });
    it("Sets the last vm on construction", () => {
        const { pm } = makeTestRig();
        expect(pm.lastVM).not.toBeUndefined();
    });
    it("Updates the view when the callout entity changes", () => {
        const { pm, callout } = makeTestRig();
        const spy = jest.spyOn(pm, "doUpdateView");
        callout.size = 2;
        expect(spy).toHaveBeenCalled();
    });
    it("Returns true if the VMs are the same", () => {
        const { pm } = makeTestRig();
        const vm1 = 2;
        const vm2 = 2;
        expect(pm.vmsAreEqual(vm1, vm2)).toEqual(true);
    });
    it("Returns false if the vms are different", () => {
        const { pm } = makeTestRig();
        const vm1 = 1;
        const vm2 = 2;
        expect(pm.vmsAreEqual(vm1, vm2)).toEqual(false);
    });
});
//# sourceMappingURL=CalloutSizePM.test.js.map