"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("@vived/core");
const Entity_1 = require("../Entity");
const IsAuthoringPM_1 = require("./IsAuthoringPM");
function makeTestRig() {
    const appObjects = (0, core_1.makeAppObjectRepo)();
    const registerSpy = jest.spyOn(appObjects, "registerSingleton");
    const app = appObjects.getOrCreate("app");
    const baseApp = (0, Entity_1.makeBaseAppState)(app);
    const pm = (0, IsAuthoringPM_1.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_1.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