"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("@vived/core");
const SceneRoot_1 = require("../../SceneRoot");
const Entities_1 = require("../Entities");
const HasStoredViewPM_1 = require("./HasStoredViewPM");
function makeTestRig() {
    const appObjects = (0, core_1.makeAppObjectRepo)();
    const ao = appObjects.getOrCreate("Scene Root");
    (0, SceneRoot_1.makeSceneRootEntity)(ao);
    const storedView = (0, Entities_1.makeStoredView)(ao);
    const pm = (0, HasStoredViewPM_1.makeHasStoredViewPM)(ao);
    return { storedView, pm, appObjects };
}
describe("Has Stored View Presentation Manager", () => {
    it("Initializes the VM", () => {
        const { pm } = makeTestRig();
        const lastVM = pm.lastVM;
        expect(lastVM).toEqual(false);
    });
    it("Sets the show based on the is rendering flag", () => {
        const { pm, storedView } = makeTestRig();
        storedView.hasStoredView = false;
        storedView.notifyOnChange();
        expect(pm.lastVM).toEqual(false);
        storedView.hasStoredView = true;
        storedView.notifyOnChange();
        expect(pm.lastVM).toEqual(true);
    });
    it("Checks for equal vms", () => {
        const { pm } = makeTestRig();
        expect(pm.vmsAreEqual(true, true)).toEqual(true);
        expect(pm.vmsAreEqual(false, false)).toEqual(true);
    });
    it("Checks for a change in the VM", () => {
        const { pm } = makeTestRig();
        expect(pm.vmsAreEqual(true, false)).toEqual(false);
        expect(pm.vmsAreEqual(false, true)).toEqual(false);
    });
    it("Gets the PM", () => {
        const { pm, appObjects } = makeTestRig();
        expect(HasStoredViewPM_1.HasStoredViewPM.get(appObjects)).toEqual(pm);
    });
});
//# sourceMappingURL=HasStoredViewPM.test.js.map