import "jest-extended";
import { Question } from "../../src/classes/question";
import { QuestionControleur } from "../../src/controleurs/questionControleur";


const qCours = "LOGTEST-01";
const qCategorie = "TEST";
const qnom = "QUESTION TEST";
const qenonce = "ENNONCE TEST";
const qresponse = true;
const retroPositif = "POSITIF TEST";
const retroNegatif = "NEGATIF TEST";
const qenseignant = "ENSEIGNANT TEST";

describe('QuestionControleur test', () => {
    let question01: Question;
    let qCtrl: QuestionControleur;
    beforeEach(async() =>  {
        qCtrl = new QuestionControleur();
        question01 = new Question(qCours, qCategorie, qnom, qenonce, qresponse, retroPositif, retroNegatif, qenseignant);
    });

    it('recupererQuestions',async () => {
        await expect(qCtrl.recupererQuestions()).toMatchObject(new Map<string, Question>());
    });

    it('ajouterQuestion',async () => {
        qCtrl.ajouterQuestion(qCours, qCategorie, qnom, qenonce, qresponse, retroPositif, retroNegatif, qenseignant);
        expect(qCtrl.recupererQuestions().size).toBe(1);
        qCtrl.ajouterQuestion(qCours+"2", qCategorie, qnom+" second", qenonce+" second", qresponse, retroPositif+" second", retroNegatif+" second", qenseignant+" second");
        expect(qCtrl.recupererQuestions().size).toBe(2);
        // expect(qCtrl.ajouterQuestion(qCours, qCategorie, qnom, qenonce, qresponse, retroPositif, retroNegatif, qenseignant)).toThrowError();
    });
});
