1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Nock some endpoints to improve test perf (#16940)

This commit is contained in:
Brad Decker 2022-12-13 15:20:24 -05:00 committed by GitHub
parent dd59792392
commit e83111cc7e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 32 additions and 0 deletions

View File

@ -4,6 +4,7 @@ import proxyquire from 'proxyquire';
import { ApprovalRequestNotFoundError } from '@metamask/approval-controller';
import { PermissionsRequestNotFoundError } from '@metamask/permission-controller';
import nock from 'nock';
import { ORIGIN_METAMASK } from '../../shared/constants/app';
const Ganache = require('../../test/e2e/ganache');
@ -59,6 +60,21 @@ describe('MetaMaskController', function () {
});
beforeEach(function () {
nock('https://static.metafi.codefi.network')
.persist()
.get('/api/v1/lists/eth_phishing_detect_config.json')
.reply(
200,
JSON.stringify({
version: 2,
tolerance: 2,
fuzzylist: [],
whitelist: [],
blacklist: ['127.0.0.1'],
}),
)
.get('/api/v1/lists/phishfort_hotlist.json')
.reply(200, JSON.stringify(['127.0.0.1']));
metamaskController = new MetaMaskController({
showUserConfirmation: noop,
encryptor: {
@ -82,6 +98,7 @@ describe('MetaMaskController', function () {
afterEach(function () {
sandbox.restore();
nock.cleanAll();
});
after(async function () {

View File

@ -117,6 +117,21 @@ describe('MetaMaskController', function () {
.persist()
.get(/.*/u)
.reply(200, '{"JPY":12415.9}');
nock('https://static.metafi.codefi.network')
.persist()
.get('/api/v1/lists/eth_phishing_detect_config.json')
.reply(
200,
JSON.stringify({
version: 2,
tolerance: 2,
fuzzylist: [],
whitelist: [],
blacklist: ['127.0.0.1'],
}),
)
.get('/api/v1/lists/phishfort_hotlist.json')
.reply(200, JSON.stringify(['127.0.0.1']));
sandbox.replace(browser, 'runtime', {
sendMessage: sandbox.stub().rejects(),