Skip to content

Commit

Permalink
Fix failed tests for index management
Browse files Browse the repository at this point in the history
  • Loading branch information
Samiul-TheSoccerFan committed Nov 19, 2024
1 parent 454bcb4 commit ea3b18b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -836,7 +836,6 @@ describe('<IndexDetailsPage />', () => {
testBed.actions.mappings.isReferenceFieldVisible();
testBed.actions.mappings.selectInferenceIdButtonExists();
testBed.actions.mappings.openSelectInferencePopover();
testBed.actions.mappings.expectDefaultInferenceModelToExists();
testBed.actions.mappings.expectCustomInferenceModelToExists(
`custom-inference_${customInferenceModel}`
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ jest.mock('../../../public/application/components/mappings_editor/mappings_state
jest.mock('../../../public/application/services/api', () => ({
useLoadInferenceEndpoints: jest.fn().mockReturnValue({
data: [
{ inference_id: '.elser-2-elasticsearch', task_type: 'sparse_embedding' },
{ inference_id: '.multilingual-e5-small-elasticsearch', task_type: 'text_embedding' },
{ inference_id: 'endpoint-1', task_type: 'text_embedding' },
{ inference_id: 'endpoint-2', task_type: 'sparse_embedding' },
{ inference_id: 'endpoint-3', task_type: 'completion' },
Expand All @@ -83,7 +85,7 @@ jest.mock('../../../public/application/services/api', () => ({
function getTestForm(Component: React.FC<SelectInferenceIdProps>) {
return (defaultProps: SelectInferenceIdProps) => {
const { form } = useForm();
form.setFieldValue('inference_id', 'elser_model_2');
form.setFieldValue('inference_id', '.elser-2-elasticsearch');
return (
<Form form={form}>
<Component {...(defaultProps as any)} />
Expand Down Expand Up @@ -125,8 +127,10 @@ describe('SelectInferenceId', () => {

it('should display the inference endpoints in the combo', () => {
find('inferenceIdButton').simulate('click');
expect(find('data-inference-endpoint-list').contains('e5')).toBe(true);
expect(find('data-inference-endpoint-list').contains('elser_model_2')).toBe(true);
expect(find('data-inference-endpoint-list').contains('.elser-2-elasticsearch')).toBe(true);
expect(
find('data-inference-endpoint-list').contains('.multilingual-e5-small-elasticsearch')
).toBe(true);
expect(find('data-inference-endpoint-list').contains('endpoint-1')).toBe(true);
expect(find('data-inference-endpoint-list').contains('endpoint-2')).toBe(true);
expect(find('data-inference-endpoint-list').contains('endpoint-3')).toBe(false);
Expand Down

0 comments on commit ea3b18b

Please sign in to comment.