diff --git a/lib/services/fee/index.js b/lib/services/fee/index.js index aa06a5a8..7299b56f 100644 --- a/lib/services/fee/index.js +++ b/lib/services/fee/index.js @@ -10,7 +10,7 @@ var FeeService = function(options) { pass: 'local321', host: 'localhost', protocol: 'http', - port: 8333 + port: 8332 }; BaseService.call(this, options); diff --git a/test/services/fee/index.unit.js b/test/services/fee/index.unit.js new file mode 100644 index 00000000..668b438c --- /dev/null +++ b/test/services/fee/index.unit.js @@ -0,0 +1,47 @@ +'use strict'; + +var sinon = require('sinon'); +var FeeService = require('../../../lib/services/fee'); + +var expect = require('chai').expect; + +describe.only('#Fee Service', function() { + var feeService; + var sandbox; + beforeEach(function() { + sandbox = sinon.sandbox.create(); + feeService = new FeeService({ + "rpc": { + "user": "bitcoin", + "pass": "local321", + "host": "localhost", + "protocol": "http", + "port": 8332 + } + }); + }); + + afterEach(function() { + sandbox.restore(); + }); + + /* + Running in regtest mode or unsync'd will return -1 + */ + + it("Has an estimateFee method", function() { + var method = feeService.getAPIMethods()[0][0]; + expect(method).to.equal('estimateFee'); + }) + + it("Can estimate fees", function(done) { + feeService.estimateFee(4, function(err, fee) { + expect(err).to.be.a('null'); + expect(fee.result).to.exist; + expect(fee.result).to.be.at.least(-1); + done(); + }); + }) + + +}); \ No newline at end of file