import { makeAppObjectRepo } from "@vived/core";
import { makeBaseAppState } from "../Entity";
import { IsAuthoringPM, makeIsAuthoringPM } from "./IsAuthoringPM";
function makeTestRig() {
    const appObjects = makeAppObjectRepo();
    const registerSpy = jest.spyOn(appObjects, "registerSingleton");
    const app = appObjects.getOrCreate("app");
    const baseApp = makeBaseAppState(app);
    const pm = makeIsAuthoringPM(app);
    return { baseApp, pm, appObjects, registerSpy };
}
describe("Is Authoring Presentation Manager", () => {
    it("Updates the view when the app mode changes", () => {
        const { baseApp, pm } = makeTestRig();
        expect(pm.lastVM).toEqual(false);
        baseApp.isAuthoring = true;
        expect(pm.lastVM).toEqual(true);
    });
    it("Checks for VMs to be equal", () => {
        const { pm } = makeTestRig();
        expect(pm.vmsAreEqual(false, true)).toEqual(false);
        expect(pm.vmsAreEqual(true, false)).toEqual(false);
        expect(pm.vmsAreEqual(true, true)).toEqual(true);
        expect(pm.vmsAreEqual(false, false)).toEqual(true);
    });
    it("Gets the PM", () => {
        const { pm, appObjects } = makeTestRig();
        expect(IsAuthoringPM.get(appObjects)).toEqual(pm);
    });
    it("Initializes the VM", () => {
        const { pm } = makeTestRig();
        expect(pm.lastVM).not.toBeUndefined();
    });
    it("Registers as the singleton", () => {
        const { pm, registerSpy } = makeTestRig();
        expect(registerSpy).toHaveBeenCalledWith(pm);
    });
});
//# sourceMappingURL=IsAuthoringPM.test.js.map