Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
981678deaa
commit
1ad8b59a9e
|
@ -116,6 +116,14 @@ describe('actions_connectors_list component with items', () => {
|
|||
isPreconfigured: true,
|
||||
config: {},
|
||||
},
|
||||
{
|
||||
id: '4',
|
||||
actionTypeId: 'nonexistent',
|
||||
description: 'My invalid connector type',
|
||||
referencedByCount: 1,
|
||||
isPreconfigured: false,
|
||||
config: {},
|
||||
},
|
||||
]
|
||||
);
|
||||
loadActionTypes.mockResolvedValueOnce([
|
||||
|
@ -162,7 +170,7 @@ describe('actions_connectors_list component with items', () => {
|
|||
it('renders table of connectors', async () => {
|
||||
await setup();
|
||||
expect(wrapper.find('EuiInMemoryTable')).toHaveLength(1);
|
||||
expect(wrapper.find('EuiTableRow')).toHaveLength(3);
|
||||
expect(wrapper.find('EuiTableRow')).toHaveLength(4);
|
||||
});
|
||||
|
||||
it('renders table with preconfigured connectors', async () => {
|
||||
|
@ -170,6 +178,17 @@ describe('actions_connectors_list component with items', () => {
|
|||
expect(wrapper.find('[data-test-subj="preConfiguredTitleMessage"]')).toHaveLength(2);
|
||||
});
|
||||
|
||||
it('renders unknown connector type as disabled', async () => {
|
||||
await setup();
|
||||
expect(wrapper.find('button[data-test-subj="edit4"]').getDOMNode()).toBeDisabled();
|
||||
expect(
|
||||
wrapper.find('button[data-test-subj="deleteConnector"]').last().getDOMNode()
|
||||
).not.toBeDisabled();
|
||||
expect(
|
||||
wrapper.find('button[data-test-subj="runConnector"]').last().getDOMNode()
|
||||
).toBeDisabled();
|
||||
});
|
||||
|
||||
it('supports pagination', async () => {
|
||||
await setup(
|
||||
times(15, (index) => ({
|
||||
|
|
|
@ -164,7 +164,7 @@ export const ActionsConnectorsList: React.FunctionComponent = () => {
|
|||
data-test-subj={`edit${item.id}`}
|
||||
onClick={() => editItem(item, EditConectorTabs.Configuration)}
|
||||
key={item.id}
|
||||
disabled={actionTypesIndex ? !actionTypesIndex[item.actionTypeId].enabled : true}
|
||||
disabled={actionTypesIndex ? !actionTypesIndex[item.actionTypeId]?.enabled : true}
|
||||
>
|
||||
{value}
|
||||
</EuiLink>
|
||||
|
@ -207,7 +207,7 @@ export const ActionsConnectorsList: React.FunctionComponent = () => {
|
|||
onDelete={() => setConnectorsToDelete([item.id])}
|
||||
/>
|
||||
<RunOperation
|
||||
canExecute={canExecute}
|
||||
canExecute={canExecute && actionTypesIndex && actionTypesIndex[item.actionTypeId]}
|
||||
item={item}
|
||||
onRun={() => editItem(item, EditConectorTabs.Test)}
|
||||
/>
|
||||
|
@ -226,7 +226,7 @@ export const ActionsConnectorsList: React.FunctionComponent = () => {
|
|||
columns={actionsTableColumns}
|
||||
rowProps={(item: ActionConnectorTableItem) => ({
|
||||
className:
|
||||
!actionTypesIndex || !actionTypesIndex[item.actionTypeId].enabled
|
||||
!actionTypesIndex || !actionTypesIndex[item.actionTypeId]?.enabled
|
||||
? 'actConnectorsList__tableRowDisabled'
|
||||
: '',
|
||||
'data-test-subj': 'connectors-row',
|
||||
|
@ -234,7 +234,7 @@ export const ActionsConnectorsList: React.FunctionComponent = () => {
|
|||
cellProps={(item: ActionConnectorTableItem) => ({
|
||||
'data-test-subj': 'cell',
|
||||
className:
|
||||
!actionTypesIndex || !actionTypesIndex[item.actionTypeId].enabled
|
||||
!actionTypesIndex || !actionTypesIndex[item.actionTypeId]?.enabled
|
||||
? 'actConnectorsList__tableCellDisabled'
|
||||
: '',
|
||||
})}
|
||||
|
|
Loading…
Reference in a new issue