Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
Signed-off-by: Qxisylolo <[email protected]>
  • Loading branch information
Qxisylolo committed Dec 25, 2024
1 parent 4da6ed5 commit 1b4bf6f
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ import { Flyout, Relationships } from './components';
import { SavedObjectWithMetadata } from '../../types';
import { WorkspaceObject } from 'opensearch-dashboards/public';
import { TableProps } from './components/table';
import { EuiToolTip } from '@elastic/eui';

const allowedTypes = ['index-pattern', 'visualization', 'dashboard', 'search'];

Expand Down Expand Up @@ -569,6 +570,16 @@ describe('SavedObjectsTable', () => {

describe('delete', () => {
it('should show a confirm modal with correct icons and tooltips', async () => {
const mockGetSavedObjectLabel = jest.fn((type) => {
switch (type) {
case 'index-pattern':
case 'index-patterns':
case 'indexPatterns':
return 'index patterns';
default:
return type;
}
});
const component = shallowRender();

const mockSelectedSavedObjects = [
Expand Down Expand Up @@ -597,6 +608,8 @@ describe('SavedObjectsTable', () => {
const typeField = columns.find((col) => col.field === 'type');
mockSelectedSavedObjects.forEach((savedObject) => {
const renderedContent = typeField.render(savedObject.type, savedObject);
expect(renderedContent.type).toBe(EuiToolTip);
expect(renderedContent.props.content).toBe(mockGetSavedObjectLabel(savedObject.type));
expect(renderedContent.props.content).toBe(savedObject.type);
const iconElement = renderedContent.props.children;
expect(iconElement.props.type).toBe(savedObject.meta.icon || 'apps');
Expand Down

0 comments on commit 1b4bf6f

Please sign in to comment.