tsoid
Version:
Typed functional library to deal with async operations.
23 lines (22 loc) • 908 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const flip_1 = require("../flip");
describe('flip', () => {
it('Flip a function should return the same value', () => {
const fn = (a, b) => a / b;
const flipped = flip_1.default(fn);
expect(fn(5, 2)).toBe(flipped(2, 5));
});
it('Flip and unflipped functions should return the same value', () => {
// eslint-disable-next-line no-mixed-operators
const fn = (a, b, c) => (a * b) / c;
const flipped = flip_1.flip3(fn);
expect(fn(2, 3, 4)).toBe(flipped(4, 3, 2));
});
it('Flip and unflipped function should return the same value', () => {
// eslint-disable-next-line no-mixed-operators
const fn = (a, b, c, d) => ((a * b) / c) * d;
const flipped = flip_1.flip4(fn);
expect(fn(2, 3, 4, 5)).toBe(flipped(5, 4, 3, 2));
});
});