Home Reference Source Test Repository

buildDocs/wrap.spec.js

import * as tslib_1 from "tslib";
import { expect } from 'chai';
import { Wrap } from './wrap';
describe('wrap', () => {
    it('should wrap the function', () => {
        class MyClass {
            fn2(fn, arg) {
                return fn(arg);
            }
            fn(n) {
                return n;
            }
        }
        tslib_1.__decorate([
            Wrap('fn')
        ], MyClass.prototype, "fn2", null);
        const myClass = new MyClass();
        expect(myClass.fn2(50)).to.equal(50);
    });
});