import { makeAppObjectRepo } from "@vived/core";
import { transform3dAdapter } from "./transform3dAdapter";
import { Transform3dPmMock } from "../Mocks/Transform3dPmMock";
import { defaultTransform3DVM } from "../PM/Transform3DPM";
function makeTestRig() {
    const appObjects = makeAppObjectRepo();
    const ao = appObjects.getOrCreate("id");
    const mockPM = new Transform3dPmMock(ao);
    return { appObjects, mockPM };
}
describe("Transform 3D Adapter", () => {
    it("Sets the Default VM", () => {
        expect(transform3dAdapter.defaultVM).toEqual(defaultTransform3DVM);
    });
    it("Add a view on subscribe", () => {
        const { mockPM, appObjects } = makeTestRig();
        mockPM.addView = jest.fn();
        const setVM = jest.fn();
        transform3dAdapter.subscribe("id", appObjects, setVM);
        expect(mockPM.addView).toHaveBeenCalledWith(setVM);
    });
    it("Removes a view on unsubscribe", () => {
        const { mockPM, appObjects } = makeTestRig();
        mockPM.removeView = jest.fn();
        const setVM = jest.fn();
        transform3dAdapter.unsubscribe("id", appObjects, setVM);
        expect(mockPM.removeView).toHaveBeenCalledWith(setVM);
    });
});
//# sourceMappingURL=transform3dAdapter.test.js.map