From 4ac0b972025ddd55a9a42b4a15db0a5f207f4078 Mon Sep 17 00:00:00 2001 From: frankiebee Date: Fri, 4 Aug 2017 14:36:27 -0400 Subject: test for SufficientBalance --- test/unit/util-test.js | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 test/unit/util-test.js (limited to 'test/unit/util-test.js') diff --git a/test/unit/util-test.js b/test/unit/util-test.js new file mode 100644 index 000000000..7716e4872 --- /dev/null +++ b/test/unit/util-test.js @@ -0,0 +1,41 @@ +const assert = require('assert') +const { sufficientBalance } = require('../../app/scripts/lib/util') + + +describe.only('SufficientBalance', function () { + it('returns true if max tx cost is equal to balance.', function () { + const tx = { + 'value': '0x1', + 'gas': '0x2', + 'gasPrice': '0x3', + } + const balance = '0x8' + + const result = sufficientBalance(tx, balance) + assert.ok(result, 'sufficient balance found.') + }) + + it('returns true if max tx cost is less than balance.', function () { + const tx = { + 'value': '0x1', + 'gas': '0x2', + 'gasPrice': '0x3', + } + const balance = '0x9' + + const result = sufficientBalance(tx, balance) + assert.ok(result, 'sufficient balance found.') + }) + + it('returns false if max tx cost is more than balance.', function () { + const tx = { + 'value': '0x1', + 'gas': '0x2', + 'gasPrice': '0x3', + } + const balance = '0x6' + + const result = sufficientBalance(tx, balance) + assert.ok(!result, 'insufficient balance found.') + }) +}) \ No newline at end of file -- cgit From 54739cb798b70e14d7774d9e92745188afca5461 Mon Sep 17 00:00:00 2001 From: frankiebee Date: Fri, 4 Aug 2017 14:40:22 -0400 Subject: test for pending tx watcher --- test/unit/util-test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/unit/util-test.js') diff --git a/test/unit/util-test.js b/test/unit/util-test.js index 7716e4872..6da185b2c 100644 --- a/test/unit/util-test.js +++ b/test/unit/util-test.js @@ -2,7 +2,7 @@ const assert = require('assert') const { sufficientBalance } = require('../../app/scripts/lib/util') -describe.only('SufficientBalance', function () { +describe('SufficientBalance', function () { it('returns true if max tx cost is equal to balance.', function () { const tx = { 'value': '0x1', -- cgit