import { makeAppObjectRepo } from "@vived/core";
import { LabelDropAnswerItemDetailsPmMock } from "../Mocks/LabelDropAnswerItemDetailsPmMock";
import { defaultLabelDropTargetsVM } from "../PM/LabelDropTargetsPM";
import { labelDropTargetsAdapter } from "./labelDropTargetsAdapter";
function makeTestRig() {
    const appObjects = makeAppObjectRepo();
    const ao = appObjects.getOrCreate("id");
    const mockPM = new LabelDropAnswerItemDetailsPmMock(ao);
    return { appObjects, mockPM };
}
describe("Label Drop Targets Adapter", () => {
    it("Sets the Default VM", () => {
        expect(labelDropTargetsAdapter.defaultVM).toEqual(defaultLabelDropTargetsVM);
    });
    it("Add a view on subscribe", () => {
        const { mockPM, appObjects } = makeTestRig();
        mockPM.addView = jest.fn();
        const setVM = jest.fn();
        labelDropTargetsAdapter.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();
        labelDropTargetsAdapter.unsubscribe("id", appObjects, setVM);
        expect(mockPM.removeView).toHaveBeenCalledWith(setVM);
    });
});
//# sourceMappingURL=labelDropTargetsAdapter.test.js.map