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