@bbashcode/lotide-flex
Version:
A clone of the lodash JavaScript library to practice creating various types of functions using JS.
22 lines (16 loc) • 623 B
JavaScript
// TEST CODE
const assert = require("chai").assert;
const findKeyByValue = require("../findKeyByValue");
const bestTVShowsByGenre = {
sci_fi: "The Expanse",
comedy: "Brooklyn Nine-Nine",
drama: "The Wire"
};
describe("testing findKeyByValue", ()=>{
it("should return drama for findKeyByValue(bestTVShowsByGenre, 'The Wire')", ()=>{
assert.deepEqual(findKeyByValue(bestTVShowsByGenre, "The Wire"), "drama");
});
it("should return undefined for findKeyByValue(bestTVShowsByGenre, 'That '70s Show')", ()=>{
assert.deepEqual(findKeyByValue(bestTVShowsByGenre, "That '70s Show"), undefined);
});
})