"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("@vived/core");
const Landmarks_1 = require("../../Landmarks");
const ChannelModel_1 = require("../Entities/ChannelModel");
const ModelHasLandmarksPM_1 = require("./ModelHasLandmarksPM");
function makeTestRig() {
    const appObjects = (0, core_1.makeAppObjectRepo)();
    const appObj = appObjects.getOrCreate("appObj");
    const ao = appObjects.getOrCreate("ChannelModel");
    const channelModel = (0, ChannelModel_1.makeChannelModelEntity)(ao);
    const pm = (0, ModelHasLandmarksPM_1.makeModelHasLandmarksPM)(ao);
    const modelObj = channelModel.addModelObject("modelId");
    const landmarkRepo = (0, Landmarks_1.makeLandmarkRepoEntity)(modelObj.appObject);
    landmarkRepo.addChangeObserver(modelObj.notifyOnChange);
    return { appObj, appObjects, pm, landmarkRepo };
}
describe("Model has landmarks PM", () => {
    it("Sets the last vm on construction", () => {
        const { pm } = makeTestRig();
        expect(pm.lastVM).not.toBeUndefined();
    });
    it("Updates the view when a landmark is added", () => {
        const { pm, landmarkRepo } = makeTestRig();
        expect(pm.lastVM).toEqual(false);
        landmarkRepo.createLandmark("SomeLandmark");
        expect(pm.lastVM).toEqual(true);
        landmarkRepo.deleteLandmark("SomeLandmark");
        expect(pm.lastVM).toEqual(false);
    });
    it("Compares the VMs", () => {
        const { pm } = makeTestRig();
        expect(pm.vmsAreEqual(true, true)).toEqual(true);
        expect(pm.vmsAreEqual(false, false)).toEqual(true);
        expect(pm.vmsAreEqual(false, true)).toEqual(false);
        expect(pm.vmsAreEqual(true, false)).toEqual(false);
    });
});
//# sourceMappingURL=ModelHasLandmarksPM.test.js.map