import { makeAppObjectRepo } from "@vived/core";
import { makeLandmarkRepoEntity } from "../../Landmarks";
import { makeChannelModelEntity } from "../Entities/ChannelModel";
import { makeModelHasLandmarksPM } from "./ModelHasLandmarksPM";
function makeTestRig() {
    const appObjects = makeAppObjectRepo();
    const appObj = appObjects.getOrCreate("appObj");
    const ao = appObjects.getOrCreate("ChannelModel");
    const channelModel = makeChannelModelEntity(ao);
    const pm = makeModelHasLandmarksPM(ao);
    const modelObj = channelModel.addModelObject("modelId");
    const landmarkRepo = 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