@mxmitch/lotide
Version:
A mini clone of the [Lodash](https://lodash.com) library.
23 lines (21 loc) • 798 B
JavaScript
const assert = require('chai').assert;
const findKeyByValue = require('../findKeyByValue');
describe("#findKeyByValue", () => {
it("returns comedy for Brooklyn Nine-Nine", () => {
assert.deepEqual(findKeyByValue(bestTVShowsByGenre, "Brooklyn Nine-Nine"), "comedy");
});
it("returns drama for The Wire", () => {
assert.deepEqual(findKeyByValue(bestTVShowsByGenre, "The Wire"), "drama");
});
it("returns undefined for That 70's Show", () => {
assert.deepEqual(findKeyByValue(bestTVShowsByGenre, "That '70s Show"), undefined);
});
it("returns undefined for an empty string", () => {
assert.deepEqual(findKeyByValue(bestTVShowsByGenre, ""), undefined);
});
});
const bestTVShowsByGenre = {
sciFi: "The Expanse",
comedy: "Brooklyn Nine-Nine",
drama: "The Wire"
};