Created
August 14, 2018 09:01
-
-
Save outsideris/ed59fc0fa0503de691fcd3a7b822e5e1 to your computer and use it in GitHub Desktop.
moca test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { test } = require('./util'); | |
describe('node', () => { | |
it('should something', async () => { | |
const expected = { | |
address: 'GB73FN4YLGQQ3ISDCLZGJDPZKUYF3KZGAPBIWDDEMTJXQDNP7WZ5J3RL', | |
alias: 'GB73.7WZ5', | |
state: 'NONE', | |
validators: { | |
GACYJM6DQVNLYI53IUIOC7MEKFUT2DFMFVWL4R6IPDNRG3ZKICIAFUHO: { | |
address: 'GACYJM6DQVNLYI53IUIOC7MEKFUT2DFMFVWL4R6IPDNRG3ZKICIAFUHO', | |
alias: 'GACY.ICIA', | |
endpoint: 'https://localhost:12346', | |
state: 'NONE' | |
}, | |
GDAXGCPCWAGWJZXUIWKAYZUMCRPLGX3XSCQY7CE6HNGOA34EGJFJU6PK: { | |
address: 'GDAXGCPCWAGWJZXUIWKAYZUMCRPLGX3XSCQY7CE6HNGOA34EGJFJU6PK', | |
alias: 'GDAX.GJFJ', | |
endpoint: 'https://localhost:12347', | |
state: 'NONE' | |
} | |
} | |
}; | |
await test('https://localhost:12345/node/', expected, 200) | |
}); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "sebak-e2e", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"test": "NODE_TLS_REJECT_UNAUTHORIZED=0 mocha" | |
}, | |
"author": "", | |
"license": "ISC", | |
"devDependencies": { | |
"got": "^9.0.0", | |
"mocha": "^5.2.0", | |
"unexpected": "^10.38.0" | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const expect = require('unexpected'); | |
const got = require('got'); | |
module.exports = { | |
test: async (targetUrl, expected, statusCode) => { | |
const res = await got(targetUrl); | |
expect(JSON.parse(res.body), 'to satisfy', expected) | |
if (statusCode) { | |
expect(res.statusCode, 'to be', statusCode) | |
} | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment