import { makeAppObjectRepo } from "@vived/core";
import { makeZSpaceEntity } from "../Entities";
import { makeZSpaceViewerScalePM, ZSpaceViewerScalePM, } from "./ZSpaceViewerScalePM";
function makeTestRig() {
    const appObjects = makeAppObjectRepo();
    const registerSpy = jest.spyOn(appObjects, "registerSingleton");
    const zSpace = appObjects.getOrCreate("zSpace");
    const mockZSpace = makeZSpaceEntity(zSpace);
    const pm = makeZSpaceViewerScalePM(zSpace);
    return { mockZSpace, pm, registerSpy, appObjects };
}
describe("ZSpace Display Presentation Manager", () => {
    it("Initializes the VM", () => {
        const { pm } = makeTestRig();
        const lastVM = pm.lastVM;
        expect(lastVM).toEqual(1);
    });
    it("Sets the show based on the is rendering flag", () => {
        const { pm, mockZSpace } = makeTestRig();
        mockZSpace.viewerScale = 1;
        mockZSpace.notifyOnChange();
        expect(pm.lastVM).toEqual(1);
        mockZSpace.viewerScale = 2;
        mockZSpace.notifyOnChange();
        expect(pm.lastVM).toEqual(2);
    });
    it("Checks for equal vms", () => {
        const { pm } = makeTestRig();
        expect(pm.vmsAreEqual(1, 1)).toEqual(true);
        expect(pm.vmsAreEqual(2, 2)).toEqual(true);
    });
    it("Checks for a change in the VM", () => {
        const { pm } = makeTestRig();
        expect(pm.vmsAreEqual(1, 2)).toEqual(false);
        expect(pm.vmsAreEqual(2, 1)).toEqual(false);
    });
    it("Gets the singleton", () => {
        const { appObjects, pm } = makeTestRig();
        expect(ZSpaceViewerScalePM.get(appObjects)).toEqual(pm);
    });
    it("Registers as the singleton", () => {
        const { registerSpy, pm } = makeTestRig();
        expect(registerSpy).toHaveBeenCalledWith(pm);
    });
});
//# sourceMappingURL=ZSpaceViewerScalePM.test.js.map