feat: fix unit and add e2e test

This commit is contained in:
Richard Simpson
2019-09-20 17:11:09 -05:00
parent 0b17727b1c
commit 33ba690ebb
8 changed files with 180 additions and 97 deletions

45
e2e/setup.js Normal file
View File

@@ -0,0 +1,45 @@
const got = require('got');
(async () => {
try {
// Verify Connection
await got(`http://${process.env.VAULT_HOST}:${process.env.VAULT_PORT}/v1/secret/config`, {
headers: {
'X-Vault-Token': 'testtoken',
},
});
await got(`http://${process.env.VAULT_HOST}:${process.env.VAULT_PORT}/v1/secret/data/test`, {
method: 'POST',
headers: {
'X-Vault-Token': 'testtoken',
},
body: {
data: {
a: 1,
b: 2,
c: 3,
},
},
json: true,
});
await got(`http://${process.env.VAULT_HOST}:${process.env.VAULT_PORT}/v1/secret/data/nested/test`, {
method: 'POST',
headers: {
'X-Vault-Token': 'testtoken',
},
body: {
data: {
e: 4,
f: 5,
g: 6,
},
},
json: true,
});
} catch (error) {
console.log(error);
process.exit(1);
}
})();