"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("@vived/core");
const Hideable_1 = require("../../Hideable/Entities/Hideable");
const ChannelModel_1 = require("../Entities/ChannelModel");
const ModelObjectsAreHiddenPM_1 = require("./ModelObjectsAreHiddenPM");
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, ModelObjectsAreHiddenPM_1.makeModelObjectsAreHiddenPM)(ao);
    const dm1 = channelModel.addModelObject("modelId");
    const dm2 = channelModel.addModelObject("modelId");
    const sm1Hideable = new Hideable_1.Hideable(dm1.appObject);
    const sm2Hideable = new Hideable_1.Hideable(dm2.appObject);
    sm1Hideable.addChangeObserver(dm1.notifyOnChange);
    sm2Hideable.addChangeObserver(dm2.notifyOnChange);
    return { appObj, appObjects, sm2Hideable, pm, sm1Hideable };
}
describe("Dissectable Meshes Are Hidden PM", () => {
    it("Sets the last vm on construction", () => {
        const { pm } = makeTestRig();
        expect(pm.lastVM).not.toBeUndefined();
    });
    it("Updates the view when a dissectable mesh changes it's visibility", () => {
        const { pm, sm2Hideable } = makeTestRig();
        expect(pm.lastVM).toEqual(false);
        sm2Hideable.isHidden = true;
        expect(pm.lastVM).toEqual(true);
    });
    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=ModelObjectsAreHiddenPM.test.js.map