Skip to content

Commit

Permalink
Test simulator
Browse files Browse the repository at this point in the history
  • Loading branch information
cnasikas committed Mar 10, 2020
1 parent d992c51 commit 42110b3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

import Joi from 'joi';
import Hapi from 'hapi';
import { version } from 'bluebird';

interface ServiceNowRequest extends Hapi.Request {
payload: {
Expand Down Expand Up @@ -94,10 +93,9 @@ export function initPlugin(server: Hapi.Server, path: string) {
// more info.

function servicenowHandler(request: ServiceNowRequest, h: any) {
const body = request.payload;
const text = body && body.caseId;

return jsonResponse(h, 200, 'Success');
return jsonResponse(h, 200, {
result: { sys_id: '123', number: 'INC01', sys_created_on: '2020-03-10 12:24:20' },
});
}

function jsonResponse(h: any, code: number, object?: any) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,11 @@ export default function servicenowTest({ getService }: FtrProviderContext) {
})
.expect(200);

expect(result).to.eql('ok');
expect(result).to.eql({
status: 'ok',
actionId: simulatedActionId,
data: { incidentId: '123', number: 'INC01', pushedDate: '2020-03-10T12:24:20.000Z' },
});
});

it('should handle failing with a simulated success without caseId', async () => {
Expand Down

0 comments on commit 42110b3

Please sign in to comment.