Skip to content

Commit 1a99453

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

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

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)