@mattseligman/lotide
Version:
Lotide is a mini clone of the Lodash Library to practice crating a personal npm package. It's like lodash, but without all that extra stuff. Just the things you need to start your project.
28 lines (21 loc) • 663 B
JavaScript
// test/head.js
const assert = require('chai').assert;
const head = require('../head');
// TEST CODE
describe("head.js test---", () => {
it("returns 1 for [1, 2, 3]", () => {
assert.strictEqual(head([1, 2, 3]), 1);
});
it("returns '5' for ['5']", () => {
assert.strictEqual(head(['5']), '5');
});
it("returns 5 for [5, 6, 7]", () => {
assert.strictEqual(head([5, 6, 7]), 5);
});
it(`returns "Hello" for ["Hello", "Lighthouse", "Labs"]`, () => {
assert.strictEqual(head(["Hello", "Lighthouse", "Labs"]), "Hello");
});
it("returns undefined for []", () => {
assert.strictEqual(head([]), undefined);
});
});