aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMarek Kotewicz <marek.kotewicz@gmail.com>2015-02-04 03:12:56 +0800
committerMarek Kotewicz <marek.kotewicz@gmail.com>2015-02-04 03:12:56 +0800
commitddc17196da36c1ad660b70f33f8b4eaaccdbdda8 (patch)
tree09a3246661cbf776f9250bc051569e011ea44d74 /test
parentfdcc1af4e22c65d4b920b6143918d54c66ab0d08 (diff)
downloadgo-tangerine-ddc17196da36c1ad660b70f33f8b4eaaccdbdda8.tar.gz
go-tangerine-ddc17196da36c1ad660b70f33f8b4eaaccdbdda8.tar.zst
go-tangerine-ddc17196da36c1ad660b70f33f8b4eaaccdbdda8.zip
tests && fixes for utils methods
Diffstat (limited to 'test')
-rw-r--r--test/utils.extractDisplayName.js42
-rw-r--r--test/utils.extractTypeName.js55
2 files changed, 97 insertions, 0 deletions
diff --git a/test/utils.extractDisplayName.js b/test/utils.extractDisplayName.js
new file mode 100644
index 000000000..148653ab2
--- /dev/null
+++ b/test/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');
+ });
+ });
+});
diff --git a/test/utils.extractTypeName.js b/test/utils.extractTypeName.js
new file mode 100644
index 000000000..2b4bbe767
--- /dev/null
+++ b/test/utils.extractTypeName.js
@@ -0,0 +1,55 @@
+var assert = require('assert');
+var utils = require('../lib/utils.js');
+
+describe('utils', function () {
+ describe('extractTypeName', function () {
+ it('should extract type name from method with no params', function () {
+
+ // given
+ var test = 'helloworld()';
+
+ // when
+ var typeName = utils.extractTypeName(test);
+
+ // then
+ assert.equal(typeName, '');
+ });
+
+ it('should extract type name from method with one param', function () {
+
+ // given
+ var test = 'helloworld1(int)';
+
+ // when
+ var typeName = utils.extractTypeName(test);
+
+ // then
+ assert.equal(typeName, 'int');
+ });
+
+ it('should extract type name from method with two params', function () {
+
+ // given
+ var test = 'helloworld2(int,string)';
+
+ // when
+ var typeName = utils.extractTypeName(test);
+
+ // then
+ assert.equal(typeName, 'int,string');
+ });
+
+ it('should extract type name from method with spaces between params', function () {
+
+ // given
+ var test = 'helloworld3(int, string)';
+
+ // when
+ var typeName = utils.extractTypeName(test);
+
+ // then
+ assert.equal(typeName, 'int,string');
+ });
+
+ });
+});