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