From f4333a92c1cb0f24289fa16bac6a428784e32fe2 Mon Sep 17 00:00:00 2001 From: michielmulders Date: Sat, 30 Sep 2017 19:18:50 +0200 Subject: [PATCH] Test added for testing payload thrown at incorrect API_PATH --- test/connection/test_connection.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/test/connection/test_connection.js b/test/connection/test_connection.js index 5c16baa..435e38b 100644 --- a/test/connection/test_connection.js +++ b/test/connection/test_connection.js @@ -7,18 +7,21 @@ import { Connection } from '../../src' const API_PATH = 'http://localhost:9984/api/v1/' const conn = new Connection(API_PATH) -test('payload thrown at incorrect API_PATH', t => { +test('Payload thrown at incorrect API_PATH', t => { const path = 'http://localhost:9984/api/wrong/' const connection = new Connection(path) const target = { message: 'HTTP Error: Requested page not reachable', status: '404 NOT FOUND', - requestURI: 'http://localhost:9984/api/wrong/transactionId' + requestURI: 'http://localhost:9984/api/wrong/transactions/transactionId' } - t.deepEqual(target, connection.getTransaction('transactionId')) + connection.getTransaction('transactionId') + .catch(error => { + t.deepEqual(target, error) + }) }) -test('generate API URLS', t => { +test('Generate API URLS', t => { const endpoints = { 'blocks': 'blocks', 'blocksDetail': 'blocks/%(blockId)s',