Home Reference Source Test Repository

buildDocs/partial.spec.js

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