i'm a complete beginner at mochajs and i have to test a JS scripts for project for my studi and i dont know how to do it ,i already have done some research before creating this post.
the code i have to test :
const genererateQuestion = () => {
questions = createQuestion(countries);
//Aficher suivi des questions
state.question.querySelector("#suiviQuestion").innerHTML = " Question " + questionNumber + " / " + questionTotal;
//Aficher la question
state.question.querySelector("#questionTitle").innerHTML = " Quel est le drapeau de ce pays ?"
state.question.querySelector("#pays").innerHTML = questions.pays
// Afficher les reponses
state.question.querySelector("#flag1").setAttribute("src", questions.possibilities[0]);
state.question.querySelector("#flag2").setAttribute("src", questions.possibilities[1]);
state.question.querySelector("#flag3").setAttribute("src", questions.possibilities[2]);
state.question.querySelector("#flag4").setAttribute("src", questions.possibilities[3]);
}
and the test i have reatend for now :
const { strict, strictEqual } = require('assert');
var assert = require('assert');
var FlagFinder = require('../js/flagFinder/flagFinder')
describe('Test de flagFinder',function(){
describe('genererateQuestion',function(){
it('should generate a question',function(){
strictEqual(genererateQuestion(),undefined)
})
it('should create a question',function(){
})
it('should change the state of the game',function() {
})
it('should get the answer of the player',function() {
})
it('should check the answer of the player',function(){
})
})
})
so if you can help it will be appreciated , thanks!!
Aucun commentaire:
Enregistrer un commentaire