Skip to content

Commit

Permalink
add test imported from treasure
Browse files Browse the repository at this point in the history
  • Loading branch information
matiu committed Apr 4, 2014
1 parent 921bc2f commit 8ff1464
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions test/test.Script.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,27 @@ describe('Script', function() {
});
});

// Original test from https://github.com/ryanxcharles/treasure
var testPubKeysHex = [
'02c525d65d18be8fb36ab50a21bee02ac9fdc2c176fa18791ac664ea4b95572ae0',
'02b937d54b550a3afdc2819772822d25869495f9e588b56a0205617d80514f0758',
'0266dd7664e65958f3cc67bf92ad6243bc495df5ab56691719263977104b635bea',
'02ee91377073b04d1d9d19597b81a7be3db6554bd7d16151cb5599a6107a589e70',
'02c8f63ad4822ef360b5c300f08488fa0fa24af2b2bebb6d6b602ca938ee5af793'
];

describe('#_sortKeys', function() {
it('should get the pubkeys in properly sorted order', function() {
var pubs = testPubKeysHex.map( function(hex) {
return new Buffer(hex,'hex');
});
var sorted = Script._sortKeys(pubs);
sorted[0].toString('hex').should.equal(testPubKeysHex[2]);
sorted[1].toString('hex').should.equal(testPubKeysHex[1]);
sorted[2].toString('hex').should.equal(testPubKeysHex[0]);
sorted[3].toString('hex').should.equal(testPubKeysHex[4]);
sorted[4].toString('hex').should.equal(testPubKeysHex[3]);
});
});

});

0 comments on commit 8ff1464

Please sign in to comment.