From 4fdc5c4b5163be4731d6852941cf2bef70046017 Mon Sep 17 00:00:00 2001 From: Manuel Araoz Date: Thu, 3 Jul 2014 13:13:45 -0300 Subject: [PATCH] add Structure test --- test/test.Structure.js | 43 +++++++++++++++++++++++++++++++++++------- 1 file changed, 36 insertions(+), 7 deletions(-) diff --git a/test/test.Structure.js b/test/test.Structure.js index 04b224668..3541c0f9c 100644 --- a/test/test.Structure.js +++ b/test/test.Structure.js @@ -39,13 +39,34 @@ describe('Structure model', function() { }); [ - ['m/45\'/0/0/0', {index: 0, isChange: false}], - ['m/45\'/0/0/1', {index: 1, isChange: false}], - ['m/45\'/0/0/2', {index: 2, isChange: false}], - ['m/45\'/0/1/0', {index: 0, isChange: true}], - ['m/45\'/0/1/1', {index: 1, isChange: true}], - ['m/45\'/0/1/2', {index: 2, isChange: true}], - ['m/45\'/0/0/900', {index: 900, isChange: false}], + ['m/45\'/0/0/0', { + index: 0, + isChange: false + }], + ['m/45\'/0/0/1', { + index: 1, + isChange: false + }], + ['m/45\'/0/0/2', { + index: 2, + isChange: false + }], + ['m/45\'/0/1/0', { + index: 0, + isChange: true + }], + ['m/45\'/0/1/1', { + index: 1, + isChange: true + }], + ['m/45\'/0/1/2', { + index: 2, + isChange: true + }], + ['m/45\'/0/0/900', { + index: 900, + isChange: false + }], ].forEach(function(datum) { var path = datum[0]; var result = datum[1]; @@ -55,5 +76,13 @@ describe('Structure model', function() { i.isChange.should.equal(result.isChange); }); }); + it('should get the correct result for bitcoin uri', function() { + var uri = 'bitcoin:19mP9FKrXqL46Si58pHdhGKow88SUPy1V8%3Famount=0.1&message=a%20bitcoin%20donation'; + var result = Structure.parseBitcoinURI(uri); + result.address.should.equal('19mP9FKrXqL46Si58pHdhGKow88SUPy1V8'); + result.amount.should.equal(0.1); + result.message.should.equal('a bitcoin donation'); + result.protocol.should.equal('bitcoin'); + }); });