"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("@vived/core");
const Entity_1 = require("../Entity");
const IsReviewingPM_1 = require("./IsReviewingPM");
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, IsReviewingPM_1.makeIsReviewingPM)(app);
    return { baseApp, pm, appObjects, registerSpy };
}
describe("Is Reviewing Presentation Manager", () => {
    it("Updates the view when the the flag changes", () => {
        const { baseApp, pm } = makeTestRig();
        expect(pm.lastVM).toEqual(false);
        baseApp.isReviewing = 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(IsReviewingPM_1.IsReviewingPM.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=IsReviewingPM.test.js.map