diff --git a/app/test/unit/userdata.unit.js b/app/test/unit/userdata.unit.js index 2389d50..6c3d849 100644 --- a/app/test/unit/userdata.unit.js +++ b/app/test/unit/userdata.unit.js @@ -210,84 +210,6 @@ describe('UserData', function() { }); - describe('#getBalance', function() { - - it('should return error if invalid address', function(done) { - var userdata = new UserData(os.tmpdir()); - userdata.getBalance('', function(err) { - expect(err.message).to.equal('Invalid payout address'); - done(); - }); - }); - - it('should bubble up request error', function(done) { - var UserData = proxyquire('../../lib/userdata', { - request: function(options, callback) { - callback(new Error('Unknown error')); - } - }); - var userdata = new UserData(os.tmpdir()); - userdata.getBalance( - '3HwoE3LBpQkRsghHLT7MCwFw9nRSYQwZhY', - function(err) { - expect(err.message).to.equal('Unknown error'); - done(); - } - ); - }); - - it('should return error if the body indicates one', function(done) { - var UserData = proxyquire('../../lib/userdata', { - request: function(options, callback) { - callback(null, {}, { status: 'error', message: 'FAILED' }); - } - }); - var userdata = new UserData(os.tmpdir()); - userdata.getBalance( - '3HwoE3LBpQkRsghHLT7MCwFw9nRSYQwZhY', - function(err) { - expect(err.message).to.equal('FAILED'); - done(); - } - ); - }); - - it('should return balance in the body', function(done) { - var UserData = proxyquire('../../lib/userdata', { - request: function(options, callback) { - callback(null, {}, { data: [{ balance: 100 }] }); - } - }); - var userdata = new UserData(os.tmpdir()); - userdata.getBalance( - '3HwoE3LBpQkRsghHLT7MCwFw9nRSYQwZhY', - function(err, balance) { - expect(err).to.equal(null); - expect(balance).to.equal(100); - done(); - } - ); - }); - - it('should return 0 if no error and no balance', function(done) { - var UserData = proxyquire('../../lib/userdata', { - request: function(options, callback) { - callback(null, {}, { data: [] }); - } - }); - var userdata = new UserData(os.tmpdir()); - userdata.getBalance( - '3HwoE3LBpQkRsghHLT7MCwFw9nRSYQwZhY', - function(err, balance) { - expect(err).to.equal(null); - expect(balance).to.equal(0); - done(); - } - ); - }); - - }); - describe('#saveConfig', function() { it('should write the tab objects to disk', function(done) {