diff --git a/2-mandatory/5-writing-tests.js b/2-mandatory/5-writing-tests.js index 1443608b..88d84889 100644 --- a/2-mandatory/5-writing-tests.js +++ b/2-mandatory/5-writing-tests.js @@ -35,7 +35,7 @@ function convertScoreToGrade(score) { passes. */ test("a score of 83 is grade A", () => { - expect(convertScoreToGrade(83), "Z"); + expect(convertScoreToGrade(83)).toEqual("A"); }); /* diff --git a/2-mandatory/6-writing-tests-advanced.js b/2-mandatory/6-writing-tests-advanced.js index 8d227e27..b80c7475 100644 --- a/2-mandatory/6-writing-tests-advanced.js +++ b/2-mandatory/6-writing-tests-advanced.js @@ -10,7 +10,7 @@ trainee has completed. */ -function convertScoreToGrade() { +function convertScoreToGrade(score) { let grade = null; if (score >= 80) { @@ -55,6 +55,17 @@ function formatCourseworkResult(trainee) { score: 63 } */ +// console.log(formatCourseworkResult({name: "Xin", score: 63})) +// Xin's coursework was marked as grade C. + +test("expect name to equal Xin and score to equal 63", () => { + let trainee = { + name: "Xin", + score: 63 + }; + expect(formatCourseworkResult(trainee)).toEqual("Xin's coursework was marked as grade C."); +}); + /* Write a test that checks the output of formatCourseworkResult when passed the following trainee: