import { makeAppObjectRepo } from "@vived/core";
import { makeBaseAppState } from "../../BaseApp/Entity/BaseAppState";
import { makeChallengeEntityMock } from "../Mocks/ChallengeEntityMock";
import { TryChallengeAgainUC, makeTryChallengeAgainUC, } from "./TryChallengeAgainUC";
function makeTestRig() {
    const appObjects = makeAppObjectRepo();
    const uc = makeTryChallengeAgainUC(appObjects.getOrCreate("UC"));
    const mockChallengeEntity = makeChallengeEntityMock(appObjects);
    const baseApp = makeBaseAppState(appObjects.getOrCreate("App"));
    return {
        uc,
        appObjects,
        mockChallengeEntity,
        baseApp,
    };
}
describe("Try Challenge Again UC", () => {
    it("Gets the singleton", () => {
        const { uc, appObjects } = makeTestRig();
        expect(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