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


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('Question test', () => {
    let question01: Question;
    beforeEach(async() =>  {
        question01 = new Question(qCours, qCategorie, qnom, qenonce, qresponse, retroPositif, retroNegatif, qenseignant);
    });

    it('getCours',async () => {
        await expect(question01.getCours()).toBe(qCours);
    });

    it('getCategorie',async () => {
        await expect(question01.getCategorie()).toBe(qCategorie);
    });

    it('getNom',async () => {
        await expect(question01.getNom()).toBe(qnom);
    });
    it('getEnonce',async () => {
        await expect(question01.getEnonce()).toBe(qenonce);
    });
    it('getReponse',async () => {
        await expect(question01.getReponse()).toBe(qresponse);
    });
    it('getRetroactionPositive',async () => {
        await expect(question01.getRetroactionPositive()).toBe(retroPositif);
    });
    it('getRetroactionNegative',async () => {
        await expect(question01.getRetroactionNegative()).toBe(retroNegatif);
    });
    it('getEnseignant',async () => {
        await expect(question01.getEnseignant()).toBe(qenseignant);
    });
    it('toJSON',async () => {
        //TODO : really ? using stringify ? no better way ?
        await expect(JSON.stringify(question01.toJSON())).toBe(JSON.stringify(
            {
             cours: qCours, 
             categorie: qCategorie,
             nom: qnom,
             enonce: qenonce,
             reponse: qresponse,
             retroactionPositive: retroPositif,
             retroactionNegative: retroNegatif   
        })
        );
    });

});
