"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("@vived/core");
const ZSpaceEntity_1 = require("../Entities/ZSpaceEntity");
const ZSpaceIsEnabledPM_1 = require("./ZSpaceIsEnabledPM");
function makeTestRig() {
    const appObjects = (0, core_1.makeAppObjectRepo)();
    const registerSpy = jest.spyOn(appObjects, "registerSingleton");
    const ao = appObjects.getOrCreate("zSpace");
    const zSpace = (0, ZSpaceEntity_1.makeZSpaceEntity)(ao);
    zSpace.enabled = true;
    const pm = (0, ZSpaceIsEnabledPM_1.makeZSpaceIsEnabledPM)(ao);
    return { zSpace, pm, registerSpy, appObjects };
}
describe("ZSpace Display Presentation Manager", () => {
    it("Initializes the VM", () => {
        const { pm } = makeTestRig();
        const lastVM = pm.lastVM;
        expect(lastVM).toEqual(true);
    });
    it("Sets the show based on the is rendering flag", () => {
        const { pm, zSpace } = makeTestRig();
        zSpace.enabled = false;
        zSpace.notifyOnChange();
        expect(pm.lastVM).toEqual(false);
        zSpace.enabled = true;
        zSpace.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 singleton", () => {
        const { appObjects, pm } = makeTestRig();
        expect(ZSpaceIsEnabledPM_1.ZSpaceIsEnabledPM.get(appObjects)).toEqual(pm);
    });
    it("Registers as the singleton", () => {
        const { registerSpy, pm } = makeTestRig();
        expect(registerSpy).toHaveBeenCalledWith(pm);
    });
});
//# sourceMappingURL=ZSpaceIsEnabledPM.test.js.map