mirror of https://github.com/BTCPrivate/copay.git
paypro: controller unit tests for payment protocol.
This commit is contained in:
parent
4cbc9ebf63
commit
b89ad8f3cc
|
@ -1027,7 +1027,8 @@ Wallet.prototype.createPaymentTxSync = function(options, merchantData, unspent)
|
||||||
var outs = [];
|
var outs = [];
|
||||||
merchantData.pr.pd.outputs.forEach(function(output) {
|
merchantData.pr.pd.outputs.forEach(function(output) {
|
||||||
outs.push({
|
outs.push({
|
||||||
address: self.getAddressesStr()[0] || '1NGYre1pSqTnCXaqN5gLQ1e2KNTJXjDhtF', // dummy address
|
address: self.getAddressesStr()[0]
|
||||||
|
|| 'mfWxJ45yp2SFn7UciZyNpvDKrzbhyfKrY8', // dummy address (testnet 0 * hash160)
|
||||||
amountSatStr: '0' // dummy amount
|
amountSatStr: '0' // dummy amount
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -20,6 +20,7 @@ var TransactionBuilder = bitcore.TransactionBuilder;
|
||||||
var Transaction = bitcore.Transaction;
|
var Transaction = bitcore.Transaction;
|
||||||
var Address = bitcore.Address;
|
var Address = bitcore.Address;
|
||||||
var PayPro = bitcore.PayPro;
|
var PayPro = bitcore.PayPro;
|
||||||
|
var startServer = require('./mocks/FakePayProServer');
|
||||||
|
|
||||||
var G = is_browser ? window : global;
|
var G = is_browser ? window : global;
|
||||||
G.SSL_UNTRUSTED = true;
|
G.SSL_UNTRUSTED = true;
|
||||||
|
|
|
@ -217,6 +217,32 @@ describe("Unit: Controllers", function() {
|
||||||
sinon.assert.callCount(scope.loadTxs, 1);
|
sinon.assert.callCount(scope.loadTxs, 1);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should create a payment protocol transaction proposal', function() {
|
||||||
|
var uri = 'bitcoin:1JqniWpWNA6Yvdivg3y9izLidETnurxRQm?amount=0.00001000&r=https://localhost:8080/-/request';
|
||||||
|
sendForm.address.$setViewValue(uri);
|
||||||
|
sendForm.amount.$setViewValue(1000);
|
||||||
|
|
||||||
|
scope.wallet.totalCopayers = scope.wallet.requiredCopayers = 3;
|
||||||
|
var spy = sinon.spy(scope.wallet, 'createTx');
|
||||||
|
var spy2 = sinon.spy(scope.wallet, 'sendTx');
|
||||||
|
scope.submitForm(sendForm);
|
||||||
|
sinon.assert.callCount(spy, 1);
|
||||||
|
sinon.assert.callCount(spy2, 0);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create and send a payment protocol transaction proposal', function() {
|
||||||
|
var uri = 'bitcoin:1JqniWpWNA6Yvdivg3y9izLidETnurxRQm?amount=0.00001000&r=https://localhost:8080/-/request';
|
||||||
|
sendForm.address.$setViewValue(uri);
|
||||||
|
sendForm.amount.$setViewValue(1000);
|
||||||
|
|
||||||
|
scope.wallet.totalCopayers = scope.wallet.requiredCopayers = 1;
|
||||||
|
var spy = sinon.spy(scope.wallet, 'createTx');
|
||||||
|
var spy2 = sinon.spy(scope.wallet, 'sendTx');
|
||||||
|
|
||||||
|
scope.submitForm(sendForm);
|
||||||
|
sinon.assert.callCount(spy, 1);
|
||||||
|
sinon.assert.callCount(spy2, 1);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("Unit: Version Controller", function() {
|
describe("Unit: Version Controller", function() {
|
||||||
|
|
Loading…
Reference in New Issue