Total Complexity | 6 |
Complexity/F | 1.2 |
Lines of Code | 33 |
Function Count | 5 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | /* jshint -W101, -W098 */ |
||
2 | var blocktrail = require('../'); |
||
3 | var assert = require('assert'); |
||
4 | |||
5 | /** |
||
6 | * @type APIClient |
||
7 | */ |
||
8 | var client = blocktrail.BlocktrailSDK({ |
||
9 | apiKey: process.env.BLOCKTRAIL_SDK_APIKEY || "EXAMPLE_BLOCKTRAIL_SDK_NODEJS_APIKEY", |
||
10 | apiSecret: process.env.BLOCKTRAIL_SDK_APISECRET || "EXAMPLE_BLOCKTRAIL_SDK_NODEJS_APISECRET", |
||
11 | btccom: typeof process.env.BLOCKTRAIL_SDK_BTCCOM !== "undefined" ? JSON.parse(process.env.BLOCKTRAIL_SDK_BTCCOM) : true |
||
12 | }); |
||
13 | |||
14 | describe("using promises", function() { |
||
15 | it('test block by hash', function(cb) { |
||
16 | client.block("000000000000034a7dedef4a161fa058a2d67a173a90155f3a2fe6fc132e0ebf").then(function(block) { |
||
17 | assert.ok(block['hash']); |
||
18 | assert.equal(block['hash'], '000000000000034a7dedef4a161fa058a2d67a173a90155f3a2fe6fc132e0ebf'); |
||
19 | |||
20 | cb(); |
||
21 | }) |
||
22 | .done(); |
||
23 | }); |
||
24 | |||
25 | it ("should work for address request", function(cb) { |
||
26 | client.address("1dice8EMZmqKvrGE4Qc9bUFf9PX3xaYDp").then(function(address) { |
||
27 | assert.ok(address['address']); |
||
28 | assert.equal(address['address'], '1dice8EMZmqKvrGE4Qc9bUFf9PX3xaYDp'); |
||
29 | |||
30 | cb(); |
||
31 | }) |
||
32 | .done(); |
||
33 | }); |
||
34 | }); |
||
35 |