-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: reference error for Error object
fixes #123
- Loading branch information
1 parent
62ca059
commit db898b1
Showing
2 changed files
with
50 additions
and
4 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
'use strict'; // eslint-disable-line | ||
// const http = require('http'); | ||
const assert = require('assert'); | ||
const errors = require('arsenal').errors; | ||
const IAMClient = require('../../lib/IAMClient.js'); | ||
|
||
const log = { error() {} }; | ||
const res = { statusCode: 400 }; | ||
const ret = '<Response><Code>foo</Code></Response>'; | ||
const expErr = errors.InternalError | ||
.customizeDescription('unable to translate error from vault'); | ||
|
||
describe('handling unrecognized error syntax', () => { | ||
let client; | ||
|
||
beforeEach('create client', () => client = new IAMClient('127.0.0.1')); | ||
|
||
afterEach('delete client', () => { client = undefined; }); | ||
|
||
it('should return Internal Error for unrecognized errors', done => { | ||
client.handleResponse(res, ret, log, err => { | ||
assert.deepStrictEqual(err, expErr); | ||
return done(); | ||
}); | ||
}); | ||
}); |