aboutsummaryrefslogtreecommitdiffstats
path: root/method.attachToObject.js
blob: a27a3e8211ae140288e20b226c42009d02f46f1d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
var chai = require('chai');
var assert = chai.assert;
var Method = require('../lib/web3/method');
var utils = require('../lib/utils/utils');

describe('lib/web3/method', function () {
    describe('attachToObject', function () {
        //it('attach simple function to an object', function () {
            
            //// given
            //var method = new Method({
                //name: 'hello'
            //});
            //var object = {};
            //var func = function () { return 1; };

            //// when
            //method.attachToObject(object, func);
            
            //// then
            //assert.equal(utils.isFunction(object.hello), true);
            //assert.equal(object.hello(), 1);
        //});

        //it('attach nested function to an object', function () {
            
            //// given
            //var method = new Method({
                //name: 'hello.world'
            //});
            //var object = {};
            //var func = function () { return 1; };

            //// when
            //method.attachToObject(object, func);
            
            //// then
            //assert.equal(utils.isObject(object.hello), true);
            //assert.equal(utils.isFunction(object.hello.world), true);
            //assert.equal(object.hello.world(), 1);
        //});
    });
});