"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("@vived/core");
const LandmarkEntity_1 = require("../Entities/LandmarkEntity");
const LandmarkSizePM_1 = require("./LandmarkSizePM");
function makeTestRig() {
    const appObjects = (0, core_1.makeAppObjectRepo)();
    const appObj = appObjects.getOrCreate("appObj");
    const landmarkObj = appObjects.getOrCreate("landmark");
    const landmark = (0, LandmarkEntity_1.makeLandmarkEntity)(landmarkObj);
    const pm = (0, LandmarkSizePM_1.makeLandmarkSizePM)(landmarkObj);
    const view = jest.fn();
    pm.addView(view);
    return { appObj, appObjects, pm, view, landmark };
}
describe("Landmark Size Presentation Manager", () => {
    it("Gets the PM", () => {
        const { appObjects, pm } = makeTestRig();
        expect(LandmarkSizePM_1.LandmarkSizePM.get("landmark", appObjects)).toEqual(pm);
    });
    it("Sets the last vm on construction", () => {
        const { pm } = makeTestRig();
        expect(pm.lastVM).not.toBeUndefined();
        expect(pm.lastVM).toEqual(0);
    });
    it("Updates the view when the landmark entity changes", () => {
        const { pm, landmark } = makeTestRig();
        const spy = jest.spyOn(pm, "doUpdateView");
        landmark.size = 2;
        expect(spy).toHaveBeenCalled();
    });
    it("Can be disposed", () => {
        const { pm } = makeTestRig();
        pm.dispose();
        const spy = jest.spyOn(pm, "doUpdateView");
        expect(spy).not.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 an object is added", () => {
        const { pm } = makeTestRig();
        const vm1 = 1;
        const vm2 = 2;
        expect(pm.vmsAreEqual(vm1, vm2)).toEqual(false);
    });
});
//# sourceMappingURL=LandmarkSizePM.test.js.map