-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add metrics for blockaid settings and user metrics for security alerts.
Signed-off-by: Olusegun Akintayo <akintayo.segun@gmail.com> lint fixes Signed-off-by: Olusegun Akintayo <akintayo.segun@gmail.com> use preferences controller Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com> Remove array props Use CSV instead of list Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com> use the list without spreading. Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com> use strings to store security providers key lint fix. Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com> Add metrics for blockaid provider calls count. track all methods tests for blockaid utils Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
- Loading branch information
Showing
4 changed files
with
49 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { getBlockaidMetricsParams } from '.'; | ||
import { | ||
Reason, | ||
ResultType, | ||
SecurityAlertResponse, | ||
} from '../../components/UI/BlockaidBanner/BlockaidBanner.types'; | ||
|
||
describe('getBlockaidMetricsParams', () => { | ||
it('should return empty object when securityAlertResponse is not defined', () => { | ||
const result = getBlockaidMetricsParams(undefined); | ||
expect(result).toStrictEqual({}); | ||
}); | ||
|
||
it('should return additionalParams object when securityAlertResponse defined', () => { | ||
const securityAlertResponse: SecurityAlertResponse = { | ||
resultType: ResultType.Malicious, | ||
reason: Reason.notApplicable, | ||
providerRequestsCount: { | ||
eth_call: 5, | ||
eth_getCode: 3, | ||
}, | ||
features: [], | ||
}; | ||
|
||
const result = getBlockaidMetricsParams(securityAlertResponse); | ||
expect(result).toEqual({ | ||
ui_customizations: ['flagged_as_malicious'], | ||
security_alert_response: ResultType.Malicious, | ||
security_alert_reason: Reason.notApplicable, | ||
ppom_eth_call_count: 5, | ||
ppom_eth_getCode_count: 3, | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters