Added correction for last homework.

This commit is contained in:
didier amyot committed 2023-11-16 10:52:18 -05:00
1 parent e37c3d2f7b
commit 2034b2f56b
3 files changed
+94 -56

No files matched your search

+50 -28
View File
@@ -127,31 +127,31 @@ describe("question 4", function(){
})
describe("question 6", function(){
async function testQuestion6(userInput, expt){
document.getElementById("input-1").value = userInput;
document.getElementById("button-5").click();
describe("question 5", function(){
async function testQuestion5(userInput, expt){
document.getElementById("input-4").value = userInput;
document.getElementById("button-4").click();
await sleep(100);
assert.equal(expt, document.getElementById("result-box-1").innerText)
assert.equal(expt, document.getElementById("result-box-4").innerText)
}
it("should find the proper number of existing country is input by user", async function(){
await testQuestion6("Canada", 3);
await testQuestion5("Canada", 3);
});
it("should show zero when non existing country is input by user", async function(){
await testQuestion6("France", 0);
await testQuestion5("France", 0);
});
})
describe("question 7", function(){
describe("question 6", function(){
async function testQuestion7(userInput, expt){
document.getElementById("input-2").value = userInput;
document.getElementById("button-6").click();
document.getElementById("input-1").value = userInput;
document.getElementById("button-5").click();
await sleep(100);
assert.equal(expt, document.getElementById("result-box-2").innerText)
assert.equal(expt, document.getElementById("result-box-1").innerText)
}
it("should find the proper population of existing country is input by user", async function(){
@@ -164,6 +164,23 @@ describe("question 7", function(){
})
describe("question 7", function(){
async function testQuestion7(userInput, expt){
document.getElementById("input-2").value = userInput;
document.getElementById("button-6").click();
await sleep(100);
assert.equal(expt, document.getElementById("result-box-2").innerText)
}
it("should find the proper city of existing country is input by user", async function(){
await testQuestion7("Canada", "Toronto");
});
it("should show zero when non existing country is input by user", async function(){
await testQuestion7("France", "aucune ville trouvée");
});
})
describe("question 8", function(){
async function testQuestion8(userInput, expt){
document.getElementById("input-3").value = userInput;
@@ -172,23 +189,6 @@ describe("question 8", function(){
assert.equal(expt, document.getElementById("result-box-3").innerText)
}
it("should find the proper city of existing country is input by user", async function(){
await testQuestion8("Canada", "Toronto");
});
it("should show zero when non existing country is input by user", async function(){
await testQuestion8("France", "aucune ville trouvée");
});
})
describe("question 9", function(){
async function testQuestion8(userInput, expt){
document.getElementById("input-4").value = userInput;
document.getElementById("button-8").click();
await sleep(100);
assert.equal(expt, document.getElementById("result-box-4").innerText)
}
it("should find the proper country of existing person entered by input by user", async function(){
await testQuestion8("Djaffar Bensetti", "Algerie");
});
@@ -198,5 +198,27 @@ describe("question 9", function(){
});
})
describe("question 9", function(){
async function testQuestion9(userInput, expt){
document.getElementById("input-4").value = userInput;
document.getElementById("button-8").click();
await sleep(100);
assert.equal(expt, document.getElementById("result-box-4").innerText)
}
it("Canada", async function(){
await testQuestion9("Canada", 3);
});
it("Mexique", async function(){
await testQuestion9("Mexique", 0);
});
it("France", async function(){
await testQuestion9("France", 0);
});
})
mocha.run();