"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("@vived/core");
const Entity_1 = require("../Entity");
const SlideTextPM_1 = require("./SlideTextPM");
function makeTestRig() {
    const appObjects = (0, core_1.makeAppObjectRepo)();
    const registerSpy = jest.spyOn(appObjects, "registerSingleton");
    const app = appObjects.getOrCreate("app");
    const appState = (0, Entity_1.makeBaseAppState)(app);
    const pm = (0, SlideTextPM_1.makeSlideTextPM)(app);
    return { appState, pm, appObjects, registerSpy };
}
describe("App Mode Presentation Manager", () => {
    it("Updates the view when the app mode changes", () => {
        const { appState, pm } = makeTestRig();
        const view = jest.fn();
        pm.addView(view);
        expect(appState.slideText).toEqual("");
        appState.slideText = "Hello World";
        expect(view).toHaveBeenCalledWith("Hello World");
    });
    it("Checks for VMs to be equal", () => {
        const { pm } = makeTestRig();
        expect(pm.vmsAreEqual("String 1", "String 2")).toEqual(false);
        expect(pm.vmsAreEqual("String 1", "String 1")).toEqual(true);
    });
    it("Gets the PM", () => {
        const { pm, appObjects } = makeTestRig();
        expect(SlideTextPM_1.SlideTextPM.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=SlideTextPM.test.js.map