Browse Source

add tests

activeAddress
Matias Alejo Garcia 10 years ago
parent
commit
d7357c53ea
  1. 49
      test/integration.js

49
test/integration.js

@ -189,14 +189,55 @@ describe('Copay server', function() {
}); });
}); });
describe.skip('#getInstanceWithAuth', function() { describe('#getInstanceWithAuth', function() {
beforeEach(function() {}); beforeEach(function() {});
it('should get server instance for existing copayer', function(done) {}); it('should get server instance for existing copayer', function(done) {
helpers.createAndJoinWallet(1, 2, function(s, wallet, copayers, copayerIds) {
var xpriv = copayers[0].xPrivKey;
var priv = Bitcore.HDPrivateKey
.fromString(xpriv)
.derive('m/1/0')
.privateKey
.toString();
it('should fail when requesting for non-existent copayer', function(done) {}); var message = 'hola';
var sig = SignUtils.sign(message, priv);
it('should fail when message signature cannot be verified', function(done) {}); CopayServer.getInstanceWithAuth({
copayerId: copayerIds[0],
message: message,
signature: sig,
}, function(err, server) {
should.not.exist(err);
done();
});
});
});
it('should fail when requesting for non-existent copayer', function(done) {
CopayServer.getInstanceWithAuth({
copayerId: 'ads',
message: 'dummy',
signature: 'dummy',
}, function(err, server) {
err.should.contain('Copayer not found');
done();
});
});
it('should fail when message signature cannot be verified', function(done) {
helpers.createAndJoinWallet(1, 2, function(s, wallet, copayers, copayerIds) {
CopayServer.getInstanceWithAuth({
copayerId: copayerIds[0],
message: 'dummy',
signature: 'dummy',
}, function(err, server) {
err.should.contain('Invalid signature');
done();
});
});
});
}); });
describe('#createWallet', function() { describe('#createWallet', function() {

Loading…
Cancel
Save