forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update Preconfigured Endpoint Names (elastic#197498)
## Summary Updates the preconfigured names as backend changes are merged. ![Screenshot 2024-10-23 at 12 15 18 PM](https://github.com/user-attachments/assets/1cec2662-8176-4262-883c-759ae50d8106) ### Checklist - [X] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios (cherry picked from commit 658ecea) # Conflicts: # x-pack/plugins/search_inference_endpoints/public/components/all_inference_endpoints/constants.ts # x-pack/plugins/search_inference_endpoints/public/components/all_inference_endpoints/render_table_columns/render_actions/actions/delete/delete_action.test.tsx # x-pack/plugins/search_inference_endpoints/public/components/all_inference_endpoints/tabular_page.test.tsx
- Loading branch information
1 parent
166a07c
commit 4e32c2f
Showing
3 changed files
with
93 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
...rence_endpoints/render_table_columns/render_actions/actions/delete/delete_action.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/* | ||
* 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 { render, screen, fireEvent } from '@testing-library/react'; | ||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; | ||
import React from 'react'; | ||
|
||
import { DeleteAction } from './delete_action'; | ||
import { InferenceEndpointUI } from '../../../../types'; | ||
|
||
describe('Delete Action', () => { | ||
const mockProvider = { | ||
inference_id: 'my-hugging-face', | ||
service: 'hugging_face', | ||
service_settings: { | ||
api_key: 'aaaa', | ||
url: 'https://dummy.huggingface.com', | ||
}, | ||
task_settings: {}, | ||
} as any; | ||
|
||
const mockItem: InferenceEndpointUI = { | ||
endpoint: 'my-hugging-face', | ||
provider: mockProvider, | ||
type: 'text_embedding', | ||
}; | ||
|
||
const Wrapper = ({ item }: { item: InferenceEndpointUI }) => { | ||
const queryClient = new QueryClient(); | ||
return ( | ||
<QueryClientProvider client={queryClient}> | ||
<DeleteAction selectedEndpoint={item} /> | ||
</QueryClientProvider> | ||
); | ||
}; | ||
it('renders', () => { | ||
render(<Wrapper item={mockItem} />); | ||
|
||
expect(screen.getByTestId('inferenceUIDeleteAction')).toBeEnabled(); | ||
}); | ||
|
||
it('disable the delete action for preconfigured endpoint', () => { | ||
const preconfiguredMockItem = { ...mockItem, endpoint: '.multilingual-e5-small-elasticsearch' }; | ||
render(<Wrapper item={preconfiguredMockItem} />); | ||
|
||
expect(screen.getByTestId('inferenceUIDeleteAction')).toBeDisabled(); | ||
}); | ||
|
||
it('loads confirm delete modal', () => { | ||
render(<Wrapper item={mockItem} />); | ||
|
||
fireEvent.click(screen.getByTestId('inferenceUIDeleteAction')); | ||
expect(screen.getByTestId('deleteModalForInferenceUI')).toBeInTheDocument(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters