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 { ApprovalRequestNotFoundError } from '@metamask/approval-controller';
|
||||||
import { PermissionsRequestNotFoundError } from '@metamask/permission-controller';
|
import { PermissionsRequestNotFoundError } from '@metamask/permission-controller';
|
||||||
|
import nock from 'nock';
|
||||||
import { ORIGIN_METAMASK } from '../../shared/constants/app';
|
import { ORIGIN_METAMASK } from '../../shared/constants/app';
|
||||||
|
|
||||||
const Ganache = require('../../test/e2e/ganache');
|
const Ganache = require('../../test/e2e/ganache');
|
||||||
@ -59,6 +60,21 @@ describe('MetaMaskController', function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
beforeEach(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({
|
metamaskController = new MetaMaskController({
|
||||||
showUserConfirmation: noop,
|
showUserConfirmation: noop,
|
||||||
encryptor: {
|
encryptor: {
|
||||||
@ -82,6 +98,7 @@ describe('MetaMaskController', function () {
|
|||||||
|
|
||||||
afterEach(function () {
|
afterEach(function () {
|
||||||
sandbox.restore();
|
sandbox.restore();
|
||||||
|
nock.cleanAll();
|
||||||
});
|
});
|
||||||
|
|
||||||
after(async function () {
|
after(async function () {
|
||||||
|
@ -117,6 +117,21 @@ describe('MetaMaskController', function () {
|
|||||||
.persist()
|
.persist()
|
||||||
.get(/.*/u)
|
.get(/.*/u)
|
||||||
.reply(200, '{"JPY":12415.9}');
|
.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', {
|
sandbox.replace(browser, 'runtime', {
|
||||||
sendMessage: sandbox.stub().rejects(),
|
sendMessage: sandbox.stub().rejects(),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user