+ {(txData?.securityProviderResponse?.flagAsDangerous !== undefined &&
+ txData?.securityProviderResponse?.flagAsDangerous !==
+ SECURITY_PROVIDER_MESSAGE_SEVERITIES.NOT_MALICIOUS) ||
+ (txData?.securityProviderResponse &&
+ Object.keys(txData.securityProviderResponse).length === 0) ? (
+
+ {(txData?.securityProviderResponse?.flagAsDangerous !== undefined &&
+ txData?.securityProviderResponse?.flagAsDangerous !==
+ SECURITY_PROVIDER_MESSAGE_SEVERITIES.NOT_MALICIOUS) ||
+ (txData?.securityProviderResponse &&
+ Object.keys(txData.securityProviderResponse).length === 0) ? (
+
+ ) : null}
{
@@ -275,5 +276,88 @@ describe('Signature Request Component', () => {
expect(getByText('Reject 2 requests')).toBeInTheDocument();
});
+
+ it('should render SecurityProviderBannerMessage component properly', () => {
+ const msgParams = {
+ data: JSON.stringify(messageData),
+ version: 'V4',
+ origin: 'test',
+ };
+
+ const { queryByText } = renderWithProvider(
+ undefined}
+ cancel={() => undefined}
+ cancelAll={() => undefined}
+ mostRecentOverviewPage="/"
+ showRejectTransactionsConfirmationModal={() => undefined}
+ history={{ push: '/' }}
+ sign={() => undefined}
+ txData={{
+ msgParams,
+ securityProviderResponse: {
+ flagAsDangerous: '?',
+ reason: 'Some reason...',
+ reason_header: 'Some reason header...',
+ },
+ }}
+ fromAccount={{ address: fromAddress }}
+ provider={{ type: 'rpc' }}
+ unapprovedMessagesCount={2}
+ />,
+ store,
+ );
+
+ expect(queryByText('Request not verified')).toBeInTheDocument();
+ expect(
+ queryByText(
+ 'Because of an error, this request was not verified by the security provider. Proceed with caution.',
+ ),
+ ).toBeInTheDocument();
+ expect(
+ queryByText('This is based on information from'),
+ ).toBeInTheDocument();
+ });
+
+ it('should not render SecurityProviderBannerMessage component when flagAsDangerous is not malicious', () => {
+ const msgParams = {
+ data: JSON.stringify(messageData),
+ version: 'V4',
+ origin: 'test',
+ };
+
+ const { queryByText } = renderWithProvider(
+ undefined}
+ cancel={() => undefined}
+ cancelAll={() => undefined}
+ mostRecentOverviewPage="/"
+ showRejectTransactionsConfirmationModal={() => undefined}
+ history={{ push: '/' }}
+ sign={() => undefined}
+ txData={{
+ msgParams,
+ securityProviderResponse: {
+ flagAsDangerous:
+ SECURITY_PROVIDER_MESSAGE_SEVERITIES.NOT_MALICIOUS,
+ },
+ }}
+ fromAccount={{ address: fromAddress }}
+ provider={{ type: 'rpc' }}
+ unapprovedMessagesCount={2}
+ />,
+ store,
+ );
+
+ expect(queryByText('Request not verified')).toBeNull();
+ expect(
+ queryByText(
+ 'Because of an error, this request was not verified by the security provider. Proceed with caution.',
+ ),
+ ).toBeNull();
+ expect(queryByText('This is based on information from')).toBeNull();
+ });
});
});