UNPKG

@emilywaters/lotide

Version:

Lotide is an equality assertion tool, a simplistic model of Lodash

28 lines (19 loc) 593 B
const assert = require('chai').assert; const head = require('../head'); describe('#head', () => { 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 'Hello' for ['Hello', 'Lighthouse', 'Labs']", () => { assert.strictEqual(head(['5']), '5'); }); it("returns undefined for []", () => { assert.strictEqual(head([]), undefined); }); it("returns undefined for non-arrays", () => { assert.strictEqual(head(0), undefined); }); });