Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Security Solution][Case] Show the current connector name in case view #93018

Merged
merged 1 commit into from
Mar 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the dumb question but how does the new name get set? Is it changed by a different test? Or in one of the mock implementations above?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey! It is set in useConnectorsMock.mockImplementation(() => ({ connectors: connectorsMock, loading: false }));.

).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