web3.js/test/utils.extractDisplayName.js

43 lines
1.1 KiB
JavaScript
Raw Normal View History

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