Home Reference Source Test Repository

buildDocs/partialRight.spec.js

import * as tslib_1 from "tslib";
import { expect } from 'chai';
import { PartialRight } from './partialRight';
describe('partialRight', () => {
    it('should create a partially applied function', () => {
        class MyClass {
            constructor() {
                this.firstName = 'Avry';
            }
            fn(name) {
                return `${this.firstName} ${name}`;
            }
        }
        tslib_1.__decorate([
            PartialRight('fn', 'Sojka')
        ], MyClass.prototype, "fn2", void 0);
        const myClass = new MyClass();
        expect(myClass.fn2).to.be.a('function');
        expect(myClass.fn2()).to.equal('Avry Sojka');
    });
});