"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const challengeAuthorHelpHookAdapter_1 = require("./challengeAuthorHelpHookAdapter");
const ChallengeAuthorHelpPM_1 = require("../PMs/ChallengeAuthorHelpPM");
const MockChallengeAuthorHelpPM_1 = require("../Mocks/MockChallengeAuthorHelpPM");
const core_1 = require("@vived/core");
function makeTestRig() {
    const appObjects = (0, core_1.makeAppObjectRepo)();
    const mockPM = (0, MockChallengeAuthorHelpPM_1.makeMockChallengeAuthorHelpPM)(appObjects);
    return { appObjects, mockPM };
}
describe("Selected Challenge Hook Adapter", () => {
    it("Sets the Default VM", () => {
        expect(challengeAuthorHelpHookAdapter_1.challengeAuthorHelpHookAdapter.defaultVM).toEqual(ChallengeAuthorHelpPM_1.defaultChallengeAuthorHelpVM);
    });
    it("Add a view on subscribe", () => {
        const { mockPM, appObjects } = makeTestRig();
        mockPM.addView = jest.fn();
        const setVM = jest.fn();
        challengeAuthorHelpHookAdapter_1.challengeAuthorHelpHookAdapter.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();
        challengeAuthorHelpHookAdapter_1.challengeAuthorHelpHookAdapter.unsubscribe(appObjects, setVM);
        expect(mockPM.removeView).toHaveBeenCalledWith(setVM);
    });
});
//# sourceMappingURL=challengeAuthorHelpHookAdapter.test.js.map