Skip to content

Commit 7af2548

Browse files
tenthirtyonetenthirtyone
authored andcommitted
Fee service unit test
1 parent f7da836 commit 7af2548

File tree

2 files changed

+48
-1
lines changed

2 files changed

+48
-1
lines changed

lib/services/fee/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ var FeeService = function(options) {
1010
pass: 'local321',
1111
host: 'localhost',
1212
protocol: 'http',
13-
port: 8333
13+
port: 8332
1414
};
1515
BaseService.call(this, options);
1616

test/services/fee/index.unit.js

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
'use strict';
2+
3+
var sinon = require('sinon');
4+
var FeeService = require('../../../lib/services/fee');
5+
6+
var expect = require('chai').expect;
7+
8+
describe.only('#Fee Service', function() {
9+
var feeService;
10+
var sandbox;
11+
beforeEach(function() {
12+
sandbox = sinon.sandbox.create();
13+
feeService = new FeeService({
14+
"rpc": {
15+
"user": "bitcoin",
16+
"pass": "local321",
17+
"host": "localhost",
18+
"protocol": "http",
19+
"port": 8332
20+
}
21+
});
22+
});
23+
24+
afterEach(function() {
25+
sandbox.restore();
26+
});
27+
28+
/*
29+
Running in regtest mode or unsync'd will return -1
30+
*/
31+
32+
it("Has an estimateFee method", function() {
33+
var method = feeService.getAPIMethods()[0][0];
34+
expect(method).to.equal('estimateFee');
35+
})
36+
37+
it("Can estimate fees", function(done) {
38+
feeService.estimateFee(4, function(err, fee) {
39+
expect(err).to.be.a('null');
40+
expect(fee.result).to.exist;
41+
expect(fee.result).to.be.at.least(-1);
42+
done();
43+
});
44+
})
45+
46+
47+
});

0 commit comments

Comments
 (0)