web3.js/test/utils.extractDisplayName.js

43 lines
1.2 KiB
JavaScript
Raw Normal View History

2015-02-03 19:12:56 +00:00
var assert = require('assert');
2015-03-08 17:18:52 +00:00
var utils = require('../lib/utils/utils.js');
2015-02-03 19:12:56 +00:00
2015-03-25 21:17:35 +00:00
describe('lib/utils/utils', function () {
2015-02-03 19:12:56 +00:00
describe('extractDisplayName', function () {
it('should extract display name from method with no params', function () {
// given
var test = 'helloworld()';
// when
var displayName = utils.extractDisplayName(test);
// then
assert.equal(displayName, 'helloworld');
});
it('should extract display name from method with one param' , function () {
// given
var test = 'helloworld1(int)';
// when
var displayName = utils.extractDisplayName(test);
// then
assert.equal(displayName, 'helloworld1');
});
it('should extract display name from method with two params' , function () {
// given
var test = 'helloworld2(int,string)';
// when
var displayName = utils.extractDisplayName(test);
// then
assert.equal(displayName, 'helloworld2');
});
});
});