paypro: begin refactoring tests.
This commit is contained in:
parent
e1478fefbf
commit
6d64935889
1 changed files with 13 additions and 8 deletions
|
|
@ -137,6 +137,18 @@ describe('PayPro (in Wallet) model', function() {
|
||||||
return w;
|
return w;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var createWallet = function() {
|
||||||
|
var w = cachedCreateW2();
|
||||||
|
unspentTest[0].address = w.publicKeyRing.getAddress(1, true, w.publicKey).toString();
|
||||||
|
unspentTest[0].scriptPubKey = w.publicKeyRing.getScriptPubKeyHex(1, true, w.publicKey);
|
||||||
|
w.getUnspent = function(cb) {
|
||||||
|
return setTimeout(function() {
|
||||||
|
return cb(null, unspentTest, []);
|
||||||
|
}, 1);
|
||||||
|
};
|
||||||
|
return w;
|
||||||
|
};
|
||||||
|
|
||||||
it('#start the example server', function(done) {
|
it('#start the example server', function(done) {
|
||||||
startServer(function(err, s) {
|
startServer(function(err, s) {
|
||||||
if (err) return done(err);
|
if (err) return done(err);
|
||||||
|
|
@ -147,15 +159,8 @@ describe('PayPro (in Wallet) model', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('#send a payment request', function(done) {
|
it('#send a payment request', function(done) {
|
||||||
var w = cachedCreateW2();
|
var w = createWallet();
|
||||||
should.exist(w);
|
should.exist(w);
|
||||||
unspentTest[0].address = w.publicKeyRing.getAddress(1, true, w.publicKey).toString();
|
|
||||||
unspentTest[0].scriptPubKey = w.publicKeyRing.getScriptPubKeyHex(1, true, w.publicKey);
|
|
||||||
w.getUnspent = function(cb) {
|
|
||||||
return setTimeout(function() {
|
|
||||||
return cb(null, unspentTest, []);
|
|
||||||
}, 1);
|
|
||||||
};
|
|
||||||
var address = 'bitcoin:mq7se9wy2egettFxPbmn99cK8v5AFq55Lx?amount=0.11&r=' + server.uri + '/request';
|
var address = 'bitcoin:mq7se9wy2egettFxPbmn99cK8v5AFq55Lx?amount=0.11&r=' + server.uri + '/request';
|
||||||
var commentText = 'Hello, server. I\'d like to make a payment.';
|
var commentText = 'Hello, server. I\'d like to make a payment.';
|
||||||
w.createTx(address, commentText, function(ntxid, ca) {
|
w.createTx(address, commentText, function(ntxid, ca) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue