add Structure test

This commit is contained in:
Manuel Araoz 2014-07-03 13:13:45 -03:00
parent 1b780d268b
commit 4fdc5c4b51
1 changed files with 36 additions and 7 deletions

View File

@ -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');
});
});