* Disabling sync alerts for observability * Adding unit tests Co-authored-by: Jonathan Buttner <56361221+jonathan-buttner@users.noreply.github.com>
This commit is contained in:
parent
7c79a81b25
commit
bd5b648997
|
@ -7,6 +7,7 @@
|
|||
|
||||
import React from 'react';
|
||||
import { mount } from 'enzyme';
|
||||
import { render } from '@testing-library/react';
|
||||
|
||||
import { basicCase } from '../../containers/mock';
|
||||
import { CaseActionBar } from '.';
|
||||
|
@ -114,4 +115,24 @@ describe('CaseActionBar', () => {
|
|||
},
|
||||
});
|
||||
});
|
||||
|
||||
it('should not show the sync alerts toggle when alerting is disabled', () => {
|
||||
const { queryByText } = render(
|
||||
<TestProviders>
|
||||
<CaseActionBar {...defaultProps} disableAlerting={true} />
|
||||
</TestProviders>
|
||||
);
|
||||
|
||||
expect(queryByText('Sync alerts')).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('should show the sync alerts toggle when alerting is enabled', () => {
|
||||
const { queryByText } = render(
|
||||
<TestProviders>
|
||||
<CaseActionBar {...defaultProps} />
|
||||
</TestProviders>
|
||||
);
|
||||
|
||||
expect(queryByText('Sync alerts')).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -59,6 +59,7 @@ export interface CaseViewComponentProps {
|
|||
* **NOTE**: Do not hold on to the `.current` object, as it could become stale
|
||||
*/
|
||||
refreshRef?: MutableRefObject<CaseViewRefreshPropInterface>;
|
||||
hideSyncAlerts?: boolean;
|
||||
}
|
||||
|
||||
export interface CaseViewProps extends CaseViewComponentProps {
|
||||
|
@ -101,6 +102,7 @@ export const CaseComponent = React.memo<CaseComponentProps>(
|
|||
useFetchAlertData,
|
||||
userCanCrud,
|
||||
refreshRef,
|
||||
hideSyncAlerts = false,
|
||||
}) => {
|
||||
const [initLoadingData, setInitLoadingData] = useState(true);
|
||||
const init = useRef(true);
|
||||
|
@ -389,7 +391,7 @@ export const CaseComponent = React.memo<CaseComponentProps>(
|
|||
caseData={caseData}
|
||||
currentExternalIncident={currentExternalIncident}
|
||||
userCanCrud={userCanCrud}
|
||||
disableAlerting={ruleDetailsNavigation == null}
|
||||
disableAlerting={ruleDetailsNavigation == null || hideSyncAlerts}
|
||||
isLoading={isLoading && (updateKey === 'status' || updateKey === 'settings')}
|
||||
onRefresh={handleRefresh}
|
||||
onUpdateField={onUpdateField}
|
||||
|
@ -509,6 +511,7 @@ export const CaseView = React.memo(
|
|||
useFetchAlertData,
|
||||
userCanCrud,
|
||||
refreshRef,
|
||||
hideSyncAlerts,
|
||||
}: CaseViewProps) => {
|
||||
const { data, isLoading, isError, fetchCase, updateCase } = useGetCase(caseId, subCaseId);
|
||||
if (isError) {
|
||||
|
@ -548,6 +551,7 @@ export const CaseView = React.memo(
|
|||
useFetchAlertData={useFetchAlertData}
|
||||
userCanCrud={userCanCrud}
|
||||
refreshRef={refreshRef}
|
||||
hideSyncAlerts={hideSyncAlerts}
|
||||
/>
|
||||
</OwnerProvider>
|
||||
</CasesTimelineIntegrationProvider>
|
||||
|
|
|
@ -156,6 +156,7 @@ export const CaseView = React.memo(({ caseId, subCaseId, userCanCrud }: Props) =
|
|||
setSelectedAlertId(alertId);
|
||||
},
|
||||
userCanCrud,
|
||||
hideSyncAlerts: true,
|
||||
})}
|
||||
</>
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue