web3.js/test/method.attachToObject.js

45 lines
1.3 KiB
JavaScript
Raw Normal View History

2015-03-22 11:48:25 -07:00
var chai = require('chai');
var assert = chai.assert;
var Method = require('../lib/web3/method');
var utils = require('../lib/utils/utils');
2015-03-25 14:17:35 -07:00
describe('lib/web3/method', function () {
2015-03-22 11:48:25 -07:00
describe('attachToObject', function () {
2015-03-26 10:11:05 -07:00
//it('attach simple function to an object', function () {
2015-03-22 11:48:25 -07:00
2015-03-26 10:11:05 -07:00
//// given
//var method = new Method({
//name: 'hello'
//});
//var object = {};
//var func = function () { return 1; };
2015-03-22 11:48:25 -07:00
2015-03-26 10:11:05 -07:00
//// when
//method.attachToObject(object, func);
2015-03-22 11:48:25 -07:00
2015-03-26 10:11:05 -07:00
//// then
//assert.equal(utils.isFunction(object.hello), true);
//assert.equal(object.hello(), 1);
//});
2015-03-22 11:48:25 -07:00
2015-03-26 10:11:05 -07:00
//it('attach nested function to an object', function () {
2015-03-22 11:48:25 -07:00
2015-03-26 10:11:05 -07:00
//// given
//var method = new Method({
//name: 'hello.world'
//});
//var object = {};
//var func = function () { return 1; };
2015-03-22 11:48:25 -07:00
2015-03-26 10:11:05 -07:00
//// when
//method.attachToObject(object, func);
2015-03-22 11:48:25 -07:00
2015-03-26 10:11:05 -07:00
//// then
//assert.equal(utils.isObject(object.hello), true);
//assert.equal(utils.isFunction(object.hello.world), true);
//assert.equal(object.hello.world(), 1);
//});
2015-03-22 11:48:25 -07:00
});
});