mirror of
https://github.com/bigchaindb/js-bigchaindb-driver.git
synced 2024-11-22 01:36:56 +01:00
Fix connection test
This commit fixes the "Payload thrown at incorrect API_PATH" test, it uses the proper way to check async error throws, taken from ava.js docs. Done with the aim to increase the coverage and to ensure working tests. Added "transform-runtime" to .babelrc to enable "await/async" syntax". Part of https://github.com/bigchaindb/js-bigchaindb-driver/issues/220
This commit is contained in:
parent
64713d3742
commit
48f7584374
3
.babelrc
3
.babelrc
@ -5,7 +5,8 @@
|
||||
"plugins": [
|
||||
"transform-export-extensions",
|
||||
"transform-object-assign",
|
||||
"transform-object-rest-spread"
|
||||
"transform-object-rest-spread",
|
||||
["transform-runtime", { "polyfill": false, "regenerator": true }]
|
||||
],
|
||||
"sourceMaps": true
|
||||
}
|
@ -46,7 +46,7 @@
|
||||
"babel-plugin-transform-export-extensions": "^6.22.0",
|
||||
"babel-plugin-transform-object-assign": "^6.22.0",
|
||||
"babel-plugin-transform-object-rest-spread": "^6.26.0",
|
||||
"babel-plugin-transform-runtime": "^6.22.0",
|
||||
"babel-plugin-transform-runtime": "^6.23.0",
|
||||
"babel-preset-env": "^1.6.1",
|
||||
"babel-preset-es2015-no-commonjs": "0.0.2",
|
||||
"babel-runtime": "^6.26.0",
|
||||
|
@ -7,7 +7,7 @@ import { API_PATH } from '../constants'
|
||||
|
||||
const conn = new Connection(API_PATH)
|
||||
|
||||
test('Payload thrown at incorrect API_PATH', t => {
|
||||
test('Payload thrown at incorrect API_PATH', async t => {
|
||||
const path = 'http://localhost:9984/api/wrong/'
|
||||
const connection = new Connection(path)
|
||||
const target = {
|
||||
@ -15,11 +15,9 @@ test('Payload thrown at incorrect API_PATH', t => {
|
||||
status: '404 NOT FOUND',
|
||||
requestURI: 'http://localhost:9984/api/wrong/transactions/transactionId'
|
||||
}
|
||||
connection.getTransaction('transactionId')
|
||||
.catch(error => {
|
||||
const error = await t.throws(connection.getTransaction('transactionId'))
|
||||
t.deepEqual(target, error)
|
||||
})
|
||||
})
|
||||
|
||||
test('Generate API URLS', t => {
|
||||
const endpoints = {
|
||||
|
Loading…
Reference in New Issue
Block a user