import { makeAppObjectRepo } from "@vived/core";
import { makeMockSelectedChallengePM } from "../Mocks/MockSelectedChallengePM";
import { defaultSelectedChallengeVM } from "../PMs/SelectedChallengePM";
import { selectedChallengeHookAdapter } from "./selectedChallengeHookAdapter";
function makeTestRig() {
    const appObjects = makeAppObjectRepo();
    const mockPM = makeMockSelectedChallengePM(appObjects);
    return { appObjects, mockPM };
}
describe("Selected Challenge Hook Adapter", () => {
    it("Sets the Default VMd", () => {
        expect(selectedChallengeHookAdapter.defaultVM).toEqual(defaultSelectedChallengeVM);
    });
    it("Add a view on subscribe", () => {
        const { mockPM, appObjects } = makeTestRig();
        mockPM.addView = jest.fn();
        const setVM = jest.fn();
        selectedChallengeHookAdapter.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();
        selectedChallengeHookAdapter.unsubscribe(appObjects, setVM);
        expect(mockPM.removeView).toHaveBeenCalledWith(setVM);
    });
});
//# sourceMappingURL=selectedChallengeHookAdapter.test.js.map