Last active
April 14, 2021 20:32
-
-
Save stoneboyindc/f725a696c7c1ac4b8899d5b75dc01c80 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const findStudentScoreByName = require("../src/solution"); | |
const expect = require("chai").expect; | |
describe("Checking equality", () => { | |
it("should return a student score if the name matches", () => { | |
const students = [ | |
{ name: "Leo Yeon-Joo", score: 8.9 }, | |
{ name: "Morgan Sutton", score: 7.4 }, | |
{ name: "Natalee Vargas", score: 9.2 }, | |
]; | |
const expected = students[0].score; | |
const existedStudent = "Leo Yeon-Joo"; | |
const actual = findStudentScoreByName(students, existedStudent); | |
expect(expected).to.equal(actual); | |
}); | |
it("should not return a student score if the name matches", () => { | |
const students = [ | |
{ name: "Leo Yeon-Joo", score: 8.9 }, | |
{ name: "Morgan Sutton", score: 7.4 }, | |
{ name: "Natalee Vargas", score: 9.2 }, | |
]; | |
const nonExistedStudent = "Foo Bar"; | |
const actual = findStudentScoreByName(students, nonExistedStudent); | |
expect(null).to.equal(actual); | |
}); | |
}); |
Author
stoneboyindc
commented
Apr 8, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment