Total Complexity | 7 |
Complexity/F | 1 |
Lines of Code | 42 |
Function Count | 7 |
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 | }); |
||
12 | |||
13 | describe("using promises", function() { |
||
14 | it('test block by hash', function(cb) { |
||
15 | client.block("000000000000034a7dedef4a161fa058a2d67a173a90155f3a2fe6fc132e0ebf").then(function(block) { |
||
16 | assert.ok(block['hash']); |
||
17 | assert.equal(block['hash'], '000000000000034a7dedef4a161fa058a2d67a173a90155f3a2fe6fc132e0ebf'); |
||
18 | |||
19 | cb(); |
||
20 | }) |
||
21 | .done(); |
||
22 | }); |
||
23 | |||
24 | it ("should work for address request", function(cb) { |
||
25 | client.address("1dice8EMZmqKvrGE4Qc9bUFf9PX3xaYDp").then(function(address) { |
||
26 | assert.ok(address['address']); |
||
27 | assert.equal(address['address'], '1dice8EMZmqKvrGE4Qc9bUFf9PX3xaYDp'); |
||
28 | |||
29 | cb(); |
||
30 | }) |
||
31 | .done(); |
||
32 | }); |
||
33 | |||
34 | it("should work for verify address request", function(cb) { |
||
35 | client.verifyAddress("16dwJmR4mX5RguGrocMfN9Q9FR2kZcLw2z", "HPMOHRgPSMKdXrU6AqQs/i9S7alOakkHsJiqLGmInt05Cxj6b/WhS7kJxbIQxKmDW08YKzoFnbVZIoTI2qofEzk=") |
||
36 | .then(function(result) { |
||
37 | assert.ok(result); |
||
38 | |||
39 | cb(); |
||
40 | }) |
||
41 | .done(); |
||
42 | }); |
||
43 | }); |
||
44 |