aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorkumavis <kumavis@users.noreply.github.com>2016-10-25 03:24:19 +0800
committerGitHub <noreply@github.com>2016-10-25 03:24:19 +0800
commit85d03cc8fbc6626a6617d46f3ecd5ec1e2e5f4fa (patch)
treecf852f8113248fcd9b2feddcb4bf6b66f3f10893 /test
parent82489129d5c8eda70f21e7037d428969e695b87b (diff)
parenteba37e773df54276e84d27c02a370719f670cc8b (diff)
downloadtangerine-wallet-browser-85d03cc8fbc6626a6617d46f3ecd5ec1e2e5f4fa.tar
tangerine-wallet-browser-85d03cc8fbc6626a6617d46f3ecd5ec1e2e5f4fa.tar.gz
tangerine-wallet-browser-85d03cc8fbc6626a6617d46f3ecd5ec1e2e5f4fa.tar.bz2
tangerine-wallet-browser-85d03cc8fbc6626a6617d46f3ecd5ec1e2e5f4fa.tar.lz
tangerine-wallet-browser-85d03cc8fbc6626a6617d46f3ecd5ec1e2e5f4fa.tar.xz
tangerine-wallet-browser-85d03cc8fbc6626a6617d46f3ecd5ec1e2e5f4fa.tar.zst
tangerine-wallet-browser-85d03cc8fbc6626a6617d46f3ecd5ec1e2e5f4fa.zip
Merge branch 'master' into i743-FixDelegateCallFlag
Diffstat (limited to 'test')
-rw-r--r--test/unit/util_test.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/unit/util_test.js b/test/unit/util_test.js
index 45e545e8e..00528b905 100644
--- a/test/unit/util_test.js
+++ b/test/unit/util_test.js
@@ -227,5 +227,27 @@ describe('util', function() {
assert.equal(result.toString(10), '1111000000000000000', 'accepts decimals')
})
})
+ describe('#isHex', function(){
+ it('should return true when given a hex string', function() {
+ var result = util.isHex('c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2')
+ assert(result)
+ })
+
+ it('should return false when given a non-hex string', function() {
+ var result = util.isHex('c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714imnotreal')
+ assert(!result)
+ })
+
+ it('should return false when given a string containing a non letter/number character', function() {
+ var result = util.isHex('c3ab8ff13720!8ad9047dd39466b3c%8974e592c2fa383d4a396071imnotreal')
+ assert(!result)
+ })
+
+ it('should return true when given a hex string with hex-prefix', function() {
+ var result = util.isHex('0xc3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2')
+ assert(result)
+ })
+
+ })
})
})