mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-22 09:57:02 +01:00
31 lines
1.1 KiB
TypeScript
31 lines
1.1 KiB
TypeScript
|
import { SECURITY_PROVIDER_MESSAGE_SEVERITY } from '../constants/security-provider';
|
||
|
import { isSuspiciousResponse } from './security-provider.utils';
|
||
|
|
||
|
describe('security-provider util', () => {
|
||
|
describe('isSuspiciousResponse', () => {
|
||
|
it('should return false if the response does not exist', () => {
|
||
|
const result = isSuspiciousResponse(undefined);
|
||
|
expect(result).toBeFalsy();
|
||
|
});
|
||
|
|
||
|
it('should return false when flagAsDangerous exists and is not malicious', () => {
|
||
|
const result = isSuspiciousResponse({
|
||
|
flagAsDangerous: SECURITY_PROVIDER_MESSAGE_SEVERITY.NOT_MALICIOUS,
|
||
|
});
|
||
|
expect(result).toBeFalsy();
|
||
|
});
|
||
|
|
||
|
it('should return true when flagAsDangerous exists and is malicious or not safe', () => {
|
||
|
const result = isSuspiciousResponse({
|
||
|
flagAsDangerous: SECURITY_PROVIDER_MESSAGE_SEVERITY.NOT_SAFE,
|
||
|
});
|
||
|
expect(result).toBeTruthy();
|
||
|
});
|
||
|
|
||
|
it('should return true if the response exists but is empty', () => {
|
||
|
const result = isSuspiciousResponse({});
|
||
|
expect(result).toBeTruthy();
|
||
|
});
|
||
|
});
|
||
|
});
|