1
0
mirror of https://github.com/bigchaindb/js-bigchaindb-driver.git synced 2025-02-14 21:10:32 +01:00

Test added for testing payload thrown at incorrect API_PATH

This commit is contained in:
michielmulders 2017-09-30 19:18:50 +02:00
parent b77d296069
commit f4333a92c1

View File

@ -7,18 +7,21 @@ import { Connection } from '../../src'
const API_PATH = 'http://localhost:9984/api/v1/' const API_PATH = 'http://localhost:9984/api/v1/'
const conn = new Connection(API_PATH) 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 path = 'http://localhost:9984/api/wrong/'
const connection = new Connection(path) const connection = new Connection(path)
const target = { const target = {
message: 'HTTP Error: Requested page not reachable', message: 'HTTP Error: Requested page not reachable',
status: '404 NOT FOUND', 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 = { const endpoints = {
'blocks': 'blocks', 'blocks': 'blocks',
'blocksDetail': 'blocks/%(blockId)s', 'blocksDetail': 'blocks/%(blockId)s',