"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("@vived/core");
const transform3dAdapter_1 = require("./transform3dAdapter");
const Transform3dPmMock_1 = require("../Mocks/Transform3dPmMock");
const Transform3DPM_1 = require("../PM/Transform3DPM");
function makeTestRig() {
    const appObjects = (0, core_1.makeAppObjectRepo)();
    const ao = appObjects.getOrCreate("id");
    const mockPM = new Transform3dPmMock_1.Transform3dPmMock(ao);
    return { appObjects, mockPM };
}
describe("Transform 3D Adapter", () => {
    it("Sets the Default VM", () => {
        expect(transform3dAdapter_1.transform3dAdapter.defaultVM).toEqual(Transform3DPM_1.defaultTransform3DVM);
    });
    it("Add a view on subscribe", () => {
        const { mockPM, appObjects } = makeTestRig();
        mockPM.addView = jest.fn();
        const setVM = jest.fn();
        transform3dAdapter_1.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_1.transform3dAdapter.unsubscribe("id", appObjects, setVM);
        expect(mockPM.removeView).toHaveBeenCalledWith(setVM);
    });
});
//# sourceMappingURL=transform3dAdapter.test.js.map