UNPKG

@rxx/worker

Version:

React MVI micro framework.

52 lines (51 loc) 2.45 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var advice_1 = require("../advice"); var chai_1 = require("chai"); describe('advice.ts', function () { describe('MethodInvocation', function () { describe('#proceed()', function () { it('should call advices method.', function () { var mi = new advice_1.MethodInvocation(function () { return this; }, 1, [], '', ''); chai_1.expect(mi.proceed()).to.be.eq(1); }); it('should arguments passed.', function () { var mi = new advice_1.MethodInvocation(function (a, b) { return a + b; }, {}, ['a', 'b'], '', ''); chai_1.expect(mi.proceed()).to.be.eq('ab'); }); }); describe('#getArguments()', function () { it('should return arguments list', function () { var mi = new advice_1.MethodInvocation(function () { }, {}, ['a', 'b'], '', ''); chai_1.expect(mi.getArguments()).to.be.deep.eq(['a', 'b']); }); }); describe('#getContext()', function () { it('should return context object', function () { var context = {}; var mi = new advice_1.MethodInvocation(function () { }, context, ['a', 'b'], '', ''); chai_1.expect(mi.getContext()).to.be.eq(context); }); }); describe('#getInstanceName()', function () { it('should return class instance name.', function () { var mi = new advice_1.MethodInvocation(function () { }, {}, ['a', 'b'], 'test', ''); chai_1.expect(mi.getInstanceName()).to.be.eq('test'); }); }); describe('#getPropertyName()', function () { it('should return property name.', function () { var mi = new advice_1.MethodInvocation(function () { }, {}, ['a', 'b'], 'test', 'test'); chai_1.expect(mi.getPropertyName()).to.be.eq('test'); }); }); describe('#getFullQualifiedName()', function () { it('should return full qualified property name..', function () { var mi = new advice_1.MethodInvocation(function () { }, {}, ['a', 'b'], 'test', 'test'); chai_1.expect(mi.getFullQualifiedName()).to.be.eq('test.test'); }); }); }); });