import { makeAppObjectRepo } from "@vived/core";
import { makeCalloutEntity } from "../Entities/CalloutEntity";
import { CalloutSizePM, makeCalloutSizePM } from "./CalloutSizePM";
function makeTestRig() {
    const appObjects = makeAppObjectRepo();
    const appObj = appObjects.getOrCreate("appObj");
    const ao = appObjects.getOrCreate("callout");
    const callout = makeCalloutEntity(ao);
    const pm = 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.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