Skip to content

Commit

Permalink
Remove duplicated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
seratch committed Mar 30, 2022
1 parent 416dd43 commit c071816
Showing 1 changed file with 0 additions and 56 deletions.
56 changes: 0 additions & 56 deletions src/receivers/HTTPReceiver.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ import {
AppInitializationError,
CustomRouteInitializationError,
HTTPReceiverDeferredRequestError,
CodedError,
} from '../errors';
import { HTTPModuleFunctions as httpFunc } from './HTTPModuleFunctions';

/* Testing Harness */

Expand Down Expand Up @@ -594,58 +592,4 @@ describe('HTTPReceiver', function () {
assert.throws(() => receiver.requestListener(fakeReq, fakeRes), HTTPReceiverDeferredRequestError);
});
});

describe('handlers for customization', async function () {
it('should have defaultDispatchErrorHandler', async function () {
const fakeReq: IncomingMessage = sinon.createStubInstance(IncomingMessage) as IncomingMessage;
fakeReq.url = '/nope';
fakeReq.method = 'GET';

const fakeRes: ServerResponse = sinon.createStubInstance(ServerResponse) as unknown as ServerResponse;
fakeRes.writeHead = sinon.fake();
fakeRes.end = sinon.fake();

httpFunc.defaultDispatchErrorHandler({
error: { code: 'foo' } as CodedError,
logger: noopLogger,
request: fakeReq,
response: fakeRes,
});
});

it('should have defaultProcessEventErrorHandler', async function () {
const fakeReq: IncomingMessage = sinon.createStubInstance(IncomingMessage) as IncomingMessage;
fakeReq.url = '/nope';
fakeReq.method = 'GET';

const fakeRes: ServerResponse = sinon.createStubInstance(ServerResponse) as unknown as ServerResponse;
fakeRes.writeHead = sinon.fake();
fakeRes.end = sinon.fake();

const result = await httpFunc.defaultProcessEventErrorHandler({
error: { code: 'foo' } as CodedError,
logger: noopLogger,
request: fakeReq,
response: fakeRes,
storedResponse: undefined,
});
assert.isFalse(result);
});

it('should have defaultUnhandledRequestHandler', async function () {
const fakeReq: IncomingMessage = sinon.createStubInstance(IncomingMessage) as IncomingMessage;
fakeReq.url = '/nope';
fakeReq.method = 'GET';

const fakeRes: ServerResponse = sinon.createStubInstance(ServerResponse) as unknown as ServerResponse;
fakeRes.writeHead = sinon.fake();
fakeRes.end = sinon.fake();

httpFunc.defaultUnhandledRequestHandler({
logger: noopLogger,
request: fakeReq,
response: fakeRes,
});
});
});
});

0 comments on commit c071816

Please sign in to comment.