Skip to content

Commit

Permalink
update test
Browse files Browse the repository at this point in the history
Signed-off-by: Qxisylolo <[email protected]>
  • Loading branch information
Qxisylolo committed Nov 1, 2024
1 parent a7d032b commit b6904f1
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 8 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -568,12 +568,12 @@ describe('SavedObjectsTable', () => {
});

describe('delete', () => {
it('should show a confirm modal', async () => {
it('should show a confirm modal with correct icons and tooltips', async () => {
const component = shallowRender();

const mockSelectedSavedObjects = [
{ id: '1', type: 'index-pattern' },
{ id: '3', type: 'dashboard' },
{ id: '1', type: 'config', meta: { icon: 'configApp' } },
{ id: '3', type: 'dashboard', meta: { icon: 'dashboardApp' } },
] as SavedObjectWithMetadata[];

// Ensure all promises resolve
Expand All @@ -590,6 +590,17 @@ describe('SavedObjectsTable', () => {
expect(component.find('EuiModalHeader')).toMatchSnapshot();
expect(component.find('EuiModalFooter')).toMatchSnapshot();
expect(component.find('Delete assets')).toMatchSnapshot();

const table = component.find('EuiInMemoryTable');
const columns = table.prop('columns');

const typeField = columns.find((col) => col.field === 'type');
mockSelectedSavedObjects.forEach((savedObject) => {
const renderedContent = typeField.render(savedObject.type, savedObject);
expect(renderedContent.props.content).toBe(savedObject.type);
const iconElement = renderedContent.props.children;
expect(iconElement.props.type).toBe(savedObject.meta.icon || 'apps');
});
});

it('should delete selected objects', async () => {
Expand Down

0 comments on commit b6904f1

Please sign in to comment.