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:
parent
dd59792392
commit
e83111cc7e
@ -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 () {
|
||||
|
@ -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(),
|
||||
|
Loading…
Reference in New Issue
Block a user