"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("@vived/core");
const BaseAppState_1 = require("../../BaseApp/Entity/BaseAppState");
const ChallengeEntityMock_1 = require("../Mocks/ChallengeEntityMock");
const TryChallengeAgainUC_1 = require("./TryChallengeAgainUC");
function makeTestRig() {
    const appObjects = (0, core_1.makeAppObjectRepo)();
    const uc = (0, TryChallengeAgainUC_1.makeTryChallengeAgainUC)(appObjects.getOrCreate("UC"));
    const mockChallengeEntity = (0, ChallengeEntityMock_1.makeChallengeEntityMock)(appObjects);
    const baseApp = (0, BaseAppState_1.makeBaseAppState)(appObjects.getOrCreate("App"));
    return {
        uc,
        appObjects,
        mockChallengeEntity,
        baseApp,
    };
}
describe("Try Challenge Again UC", () => {
    it("Gets the singleton", () => {
        const { uc, appObjects } = makeTestRig();
        expect(TryChallengeAgainUC_1.TryChallengeAgainUC.get(appObjects)).toEqual(uc);
    });
    it("Resets the challenge", () => {
        const { mockChallengeEntity, uc } = makeTestRig();
        mockChallengeEntity.resetSelectedChallenge = jest.fn();
        uc.tryChallengeAgain();
        expect(mockChallengeEntity.resetSelectedChallenge).toHaveBeenCalled();
    });
    it("Sets the app mode back to playing", () => {
        const { baseApp, uc } = makeTestRig();
        baseApp.isReviewing = true;
        uc.tryChallengeAgain();
        expect(baseApp.isReviewing).toEqual(false);
    });
});
//# sourceMappingURL=TryChallengeAgainUC.test.js.map