import { makeAppObjectRepo } from "@vived/core";
import { makeSceneRootEntity } from "../../SceneRoot";
import { makeStoredView } from "../Entities";
import { HasStoredViewPM, makeHasStoredViewPM } from "./HasStoredViewPM";
function makeTestRig() {
    const appObjects = makeAppObjectRepo();
    const ao = appObjects.getOrCreate("Scene Root");
    makeSceneRootEntity(ao);
    const storedView = makeStoredView(ao);
    const pm = 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.get(appObjects)).toEqual(pm);
    });
});
//# sourceMappingURL=HasStoredViewPM.test.js.map