Skip to content

Commit

Permalink
Fix connector's name
Browse files Browse the repository at this point in the history
  • Loading branch information
cnasikas committed Mar 1, 2021
1 parent c116477 commit ff9db7b
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -723,6 +723,32 @@ describe('CaseView ', () => {
});
});

it('should show the correct connector name on the push button', async () => {
useConnectorsMock.mockImplementation(() => ({ connectors: connectorsMock, loading: false }));
useGetCaseUserActionsMock.mockImplementation(() => ({
...defaultUseGetCaseUserActions,
hasDataToPush: true,
}));

const wrapper = mount(
<TestProviders>
<Router history={mockHistory}>
<CaseComponent {...{ ...caseProps, connector: { ...caseProps, name: 'old-name' } }} />
</Router>
</TestProviders>
);

await waitFor(() => {
expect(
wrapper
.find('[data-test-subj="has-data-to-push-button"]')
.first()
.text()
.includes('My Connector 2')
).toBe(true);
});
});

describe('Callouts', () => {
it('it shows the danger callout when a connector has been deleted', async () => {
useConnectorsMock.mockImplementation(() => ({ connectors: [], loading: false }));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ export const CaseComponent = React.memo<CaseProps>(
const { pushButton, pushCallouts } = usePushToService({
connector: {
...caseData.connector,
name: isEmpty(caseData.connector.name) ? connectorName : caseData.connector.name,
name: isEmpty(connectorName) ? caseData.connector.name : connectorName,
},
caseServices,
caseId: caseData.id,
Expand Down

0 comments on commit ff9db7b

Please sign in to comment.