Skip to content

Commit

Permalink
Add test to check custom pipeline api call (#143757)
Browse files Browse the repository at this point in the history
  • Loading branch information
efegurkan authored Oct 20, 2022
1 parent 9d479d4 commit 16d8b9f
Showing 1 changed file with 35 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

import { mockHttpValues } from '../../../__mocks__/kea_logic';

import { nextTick } from '@kbn/test-jest-helpers';

import { createCustomPipeline } from './create_custom_pipeline_api_logic';

describe('createCustomPipelineApiLogic', () => {
const { http } = mockHttpValues;
beforeEach(() => {
jest.clearAllMocks();
});

describe('createCustomPipeline', () => {
it('calls correct pipeline route', async () => {
const responsePromise = Promise.resolve({ created: ['my-custom-pipeline'] });
http.post.mockReturnValue(responsePromise);
const result = await createCustomPipeline({ indexName: 'indexName' });

await nextTick();

expect(http.post).toHaveBeenCalledWith(
'/internal/enterprise_search/indices/indexName/pipelines'
);

expect(result).toEqual({ created: ['my-custom-pipeline'] });
});
});
});

0 comments on commit 16d8b9f

Please sign in to comment.