Skip to content

Commit 2eb064f

Browse files
author
ehennum
committed
unit test for response from error mapping #542
1 parent 1213d35 commit 2eb064f

File tree

4 files changed

+46
-0
lines changed

4 files changed

+46
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
'use strict';
2+
const expect = require('chai').expect;
3+
4+
const testutil = require('../testutil');
5+
6+
const BadExecution = require("./badExecution.js");
7+
8+
describe('bad execution', function() {
9+
const service = BadExecution.on(testutil.makeClient());
10+
11+
it('error mapping', function (done) {
12+
service.errorMapping()
13+
.then(output => {
14+
expect.fail('should not succeed');
15+
done();
16+
})
17+
.catch(err => {
18+
const errorResponse = err.body.errorResponse;
19+
expect(errorResponse.statusCode).to.eql(418);
20+
expect(errorResponse.status).to.eql("Status Message For 418");
21+
expect(errorResponse.messageCode).to.eql('ERROR_MAPPING');
22+
expect(errorResponse.message).to.contain('Test of error mapping');
23+
done();
24+
});
25+
});
26+
});
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"functionName" : "errorMapping",
3+
"errorConditions":[
4+
{
5+
"errorCode": "ERROR_MAPPING",
6+
"httpStatusCode": 418,
7+
"errorMessage":"Status Message For 418"
8+
}
9+
]
10+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
'use strict';
2+
// declareUpdate(); // Note: uncomment if changing the database state
3+
4+
fn.error(null, "ERROR_MAPPING", "Test of error mapping");
5+
6+
const returnValue = "Error should be thrown before execution reaches this line";
7+
returnValue;
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"endpointDirectory" : "/dbf/test/badExecution/"
3+
}

0 commit comments

Comments
 (0)