test(server): Initial set of tests and travis integration added

This commit is contained in:
Damian Mee 2014-09-03 19:38:48 +02:00
parent f06ace8c83
commit 53646c9191
17 changed files with 400 additions and 458 deletions

View file

@ -4,7 +4,40 @@ module.exports = {
SUPPORTED_MODULES: ['wallet'],
NAME: 'Mock Wallet',
config: function() {},
balance: function() {},
sendBitcoins: function() {}
config: function config() {},
balance: function balance(callback) {
calls.balance++;
callback(null, {
BTC: 1e8
});
},
sendBitcoins: function(addr, satoshis, fee, cb) {
calls.send = true;
if (satoshis <= 1e8) cb(null, TX_HASH);
else {
var e = new Error('Insufficient funds');
e.name = 'InsufficientFunds';
cb(e);
}
}
};
// mock stuff
var calls = {
balance: 0,
send: false
};
var ADDR = module.exports.ADDR = '12sENwECeRSmTeDwyLNqwh47JistZqFmW8';
var TX_HASH = module.exports.TX_HASH = '1c12443203a48f42cdf7b1acee5b4b1c1fedc144cb909a3bf5edbffafb0cd204';
module.exports.getBalanceCalls = function() {
return calls.balance;
};
module.exports.wasSendCalled = function() {
return calls.send;
}