lodash-fantasy
Version:
Fantasy Land compatible types built with lodash.
27 lines (21 loc) • 751 B
JavaScript
;
// Third Party
const compose = require("lodash/fp/flowRight");
const curry = require("lodash/fp/curry");
const identity = require("lodash/fp/identity");
module.exports = curry((expect, Type) =>
describe("Functor", () => {
it("should express identity", () => {
const testValue = true;
const testLeft = new Type(testValue).map(identity);
const testRight = new Type(testValue);
expect(testLeft).to.eql(testRight);
});
it("should express composition", () => {
const testValue = true;
const testLeft = new Type(testValue).map(compose(identity, identity));
const testRight = new Type(testValue).map(identity).map(identity);
expect(testLeft).to.eql(testRight);
});
})
);