aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorFrankie <frankie.pangilinan@consensys.net>2016-10-20 06:22:56 +0800
committerFrankie <frankie.pangilinan@consensys.net>2016-10-20 06:22:56 +0800
commit4366f72fe1d9f0c3a94f27e5f23bd826f8cf69e0 (patch)
tree226ee5a0c43a0a13bc59d8e86c2b5bd47a733502 /test
parent5fb1e492fb32e664364603c34044c3e573501781 (diff)
downloadtangerine-wallet-browser-4366f72fe1d9f0c3a94f27e5f23bd826f8cf69e0.tar
tangerine-wallet-browser-4366f72fe1d9f0c3a94f27e5f23bd826f8cf69e0.tar.gz
tangerine-wallet-browser-4366f72fe1d9f0c3a94f27e5f23bd826f8cf69e0.tar.bz2
tangerine-wallet-browser-4366f72fe1d9f0c3a94f27e5f23bd826f8cf69e0.tar.lz
tangerine-wallet-browser-4366f72fe1d9f0c3a94f27e5f23bd826f8cf69e0.tar.xz
tangerine-wallet-browser-4366f72fe1d9f0c3a94f27e5f23bd826f8cf69e0.tar.zst
tangerine-wallet-browser-4366f72fe1d9f0c3a94f27e5f23bd826f8cf69e0.zip
Add unit test for isHex and add to CHANGELOG.md
Diffstat (limited to 'test')
-rw-r--r--test/unit/util_test.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/unit/util_test.js b/test/unit/util_test.js
index 45e545e8e..b7d8ba528 100644
--- a/test/unit/util_test.js
+++ b/test/unit/util_test.js
@@ -227,5 +227,22 @@ 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.equal(result, true)
+ })
+
+ it('should return false when given a non-hex string', function() {
+ var result = util.isHex('c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714imnotreal')
+ assert.equal(result, false)
+ })
+
+ it('should return false when given a string containing a non letter/number character', function() {
+ var result = util.isHex('c3ab8ff13720!8ad9047dd39466b3c%8974e592c2fa383d4a396071imnotreal')
+ assert.equal(result, false)
+ })
+
+ })
})
})