"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("@vived/core");
const SubmitQuestionAnswerUC_1 = require("../UC/SubmitQuestionAnswerUC");
const submitQuestionAnswer_1 = require("./submitQuestionAnswer");
class MockUC extends SubmitQuestionAnswerUC_1.SubmitQuestionAnswerUC {
    constructor() {
        super(...arguments);
        this.submitAnswer = jest.fn();
    }
}
function makeTestRig() {
    const appObjects = (0, core_1.makeAppObjectRepo)();
    const question = appObjects.getOrCreate("Question");
    const submitUC = new MockUC(question, SubmitQuestionAnswerUC_1.SubmitQuestionAnswerUC.type);
    return { submitUC, appObjects };
}
describe("submitQuestionAnswer Controller", () => {
    it("Submits to the UC", () => {
        const { submitUC, appObjects } = makeTestRig();
        (0, submitQuestionAnswer_1.submitQuestionAnswer)("an answer", appObjects);
        expect(submitUC.submitAnswer).toHaveBeenCalledWith("an answer");
    });
    it("Warns if it can't find the UC", () => {
        const { submitUC, appObjects } = makeTestRig();
        appObjects.submitWarning = jest.fn();
        submitUC.dispose();
        (0, submitQuestionAnswer_1.submitQuestionAnswer)("an answer", appObjects);
        expect(appObjects.submitWarning).toHaveBeenCalled();
    });
});
//# sourceMappingURL=submitQuestionAnswer.test.js.map