Skip to content

Commit

Permalink
Fix more types
Browse files Browse the repository at this point in the history
  • Loading branch information
kpollich committed Aug 3, 2021
1 parent c1ffbc2 commit 3f0354c
Showing 1 changed file with 0 additions and 21 deletions.
21 changes: 0 additions & 21 deletions x-pack/plugins/fleet/server/errors/handlers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ import {
defaultIngestErrorHandler,
} from './index';

type ITestEsErrorsFnParams = [errorCode: string, error: any, expectedMessage: string];

describe('defaultIngestErrorHandler', () => {
let mockContract: ReturnType<typeof createAppContextStartContractMock>;
beforeEach(async () => {
Expand All @@ -34,25 +32,6 @@ describe('defaultIngestErrorHandler', () => {
appContextService.stop();
});

async function testEsErrorsFn(...args: ITestEsErrorsFnParams) {
const [, error, expectedMessage] = args;
jest.clearAllMocks();
const response = httpServerMock.createResponseFactory();
await defaultIngestErrorHandler({ error, response });

// response
expect(response.ok).toHaveBeenCalledTimes(0);
expect(response.customError).toHaveBeenCalledTimes(1);
expect(response.customError).toHaveBeenCalledWith({
statusCode: error.status,
body: { message: expectedMessage },
});

// logging
expect(mockContract.logger?.error).toHaveBeenCalledTimes(1);
expect(mockContract.logger?.error).toHaveBeenCalledWith(expectedMessage);
}

describe('IngestManagerError', () => {
it('502: RegistryError', async () => {
const error = new RegistryError('xyz');
Expand Down

0 comments on commit 3f0354c

Please sign in to comment.