UNPKG

1.98 kBJavaScriptView Raw
1var assert = require('assert');
2var bittrex = require('../node.bittrex.api.js');
3var fs = require('fs');
4var config = JSON.parse(fs.readFileSync(__dirname+'/config.json'));
5
6bittrex.options({
7 'apikey' : config.api.key,
8 'apisecret' : config.api.secret,
9});
10
11describe('Bittrex private API', function() {
12
13 it('should respond with withdraw history for BTC', function(done) {
14 this.timeout(5000);
15 setTimeout(function() {
16 bittrex.getwithdrawalhistory({
17 currency: 'BTC',
18 }, function(data, err) {
19 assert.equal(err, null);
20 assert.ok(data.success == true);
21 done();
22 });
23 }, 500); //delay the tests so we do not trigger any Bittrex rate limits
24 });
25
26 it('should respond with deposit history for BTC', function(done) {
27 this.timeout(5000);
28 setTimeout(function() {
29 bittrex.getdeposithistory({
30 currency: 'BTC',
31 }, function(data, err) {
32 assert.equal(err, null);
33 assert.ok(data.success == true);
34 done();
35 });
36 }, 500); //delay the tests so we do not trigger any Bittrex rate limits
37 });
38
39 it('should respond with an error for a deposit history request for a currency that doesnt exist', function(done) {
40 this.timeout(5000);
41 setTimeout(function() {
42 bittrex.getdeposithistory({
43 currency: 'BTCXX',
44 }, function(data, err) {
45 assert.equal(data, null);
46 assert.notEqual(err, null);
47 assert.ok(err.success == false);
48 assert.ok(err.message.length > 0);
49 done();
50 });
51 }, 500); //delay the tests so we do not trigger any Bittrex rate limits
52 });
53
54 it('should respond with order history', function(done) {
55 this.timeout(5000);
56 setTimeout(function() {
57 bittrex.getorderhistory({}, function(data, err) {
58 assert.equal(err, null);
59 assert.ok(data.success == true);
60 done();
61 });
62 }, 500); //delay the tests so we do not trigger any Bittrex rate limits
63 });
64
65});
\No newline at end of file