fix tests

This commit is contained in:
Ivan Socolsky 2015-02-06 18:22:52 -03:00
parent ddbfcbe7f5
commit c3f6442901
1 changed files with 12 additions and 15 deletions

View File

@ -940,8 +940,6 @@ describe('Copay server', function() {
it('should sign and broadcast a tx', function(done) { it('should sign and broadcast a tx', function(done) {
helpers.stubBlockExplorer(server, utxos, '1122334455'); helpers.stubBlockExplorer(server, utxos, '1122334455');
var txOpts = { var txOpts = {
copayerId: '1',
walletId: '123',
toAddress: '18PzpUFkFZE8zKWUPvfykkTxmB9oMR8qP7', toAddress: '18PzpUFkFZE8zKWUPvfykkTxmB9oMR8qP7',
amount: helpers.toSatoshi(10), amount: helpers.toSatoshi(10),
message: 'some message', message: 'some message',
@ -953,15 +951,11 @@ describe('Copay server', function() {
txp.should.exist; txp.should.exist;
var txpid = txp.id; var txpid = txp.id;
server.getPendingTxs({ server.getPendingTxs({}, function(err, txps) {
walletId: '123'
}, function(err, txps) {
var txp = txps[0]; var txp = txps[0];
txp.id.should.equal(txpid); txp.id.should.equal(txpid);
var signatures = helpers.clientSign(txp, someXPrivKey[0], wallet.n); var signatures = helpers.clientSign(txp, someXPrivKey[0], wallet.n);
server.signTx({ server.signTx({
walletId: '123',
copayerId: '1',
txProposalId: txpid, txProposalId: txpid,
signatures: signatures, signatures: signatures,
}, function(err, txp) { }, function(err, txp) {
@ -979,8 +973,6 @@ describe('Copay server', function() {
helpers.stubBlockExplorer(server, utxos); helpers.stubBlockExplorer(server, utxos);
var txOpts = { var txOpts = {
copayerId: '1',
walletId: '123',
toAddress: '18PzpUFkFZE8zKWUPvfykkTxmB9oMR8qP7', toAddress: '18PzpUFkFZE8zKWUPvfykkTxmB9oMR8qP7',
amount: helpers.toSatoshi(10), amount: helpers.toSatoshi(10),
message: 'some message', message: 'some message',
@ -992,9 +984,7 @@ describe('Copay server', function() {
txp.should.exist; txp.should.exist;
var txpid = txp.id; var txpid = txp.id;
server.getPendingTxs({ server.getPendingTxs({}, function(err, txps) {
walletId: '123'
}, function(err, txps) {
var txp = txps[0]; var txp = txps[0];
txp.id.should.equal(txpid); txp.id.should.equal(txpid);
var signatures = helpers.clientSign(txp, someXPrivKey[0], wallet.n); var signatures = helpers.clientSign(txp, someXPrivKey[0], wallet.n);
@ -1003,9 +993,16 @@ describe('Copay server', function() {
signatures: signatures, signatures: signatures,
}, function(err, txp) { }, function(err, txp) {
err.should.contain('broadcast'); err.should.contain('broadcast');
txp.status.should.equal('accepted');
should.not.exist(txp.txid); server.getPendingTxs({}, function(err, txps) {
done(); should.not.exist(err);
txps.length.should.equal(0);
server.getTx({ id: txpid }, function (err, txp) {
txp.status.should.equal('accepted');
should.not.exist(txp.txid);
done();
});
});
}); });
}); });
}); });