| Total Complexity | 8 |
| Complexity/F | 1.14 |
| Lines of Code | 43 |
| 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 | 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 | it("should work for verify address request", function(cb) { |
||
| 36 | client.verifyAddress("16dwJmR4mX5RguGrocMfN9Q9FR2kZcLw2z", "HPMOHRgPSMKdXrU6AqQs/i9S7alOakkHsJiqLGmInt05Cxj6b/WhS7kJxbIQxKmDW08YKzoFnbVZIoTI2qofEzk=") |
||
| 37 | .then(function(result) { |
||
| 38 | assert.ok(result); |
||
| 39 | |||
| 40 | cb(); |
||
| 41 | }) |
||
| 42 | .done(); |
||
| 43 | }); |
||
| 44 | }); |
||
| 45 |