aboutsummaryrefslogtreecommitdiffstats
path: root/utils.extractDisplayName.js
diff options
context:
space:
mode:
Diffstat (limited to 'utils.extractDisplayName.js')
-rw-r--r--utils.extractDisplayName.js42
1 files changed, 42 insertions, 0 deletions
diff --git a/utils.extractDisplayName.js b/utils.extractDisplayName.js
new file mode 100644
index 00000000..148653ab
--- /dev/null
+++ b/utils.extractDisplayName.js
@@ -0,0 +1,42 @@
+var assert = require('assert');
+var utils = require('../lib/utils.js');
+
+describe('utils', function () {
+ 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');
+ });
+ });
+});