1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-01 13:47:06 +01:00
metamask-extension/development/mock-e2e.js
PeterYinusa 30b2afe7bc
E2e phishing detection (#13704)
* phishing detection test

* remove unused arg
2022-02-22 16:48:12 +00:00

35 lines
899 B
JavaScript

function setupMocking(server, testSpecificMock) {
server.forAnyRequest().thenPassThrough();
server
.forOptions('https://gas-api.metaswap.codefi.network/networks/1/gasPrices')
.thenCallback(() => {
return {
headers: {
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Methods': 'GET,HEAD,PUT,PATCH,POST,DELETE',
'Access-Control-Allow-Headers': 'content-type,x-client-id',
},
statusCode: 200,
};
});
server
.forGet('https://gas-api.metaswap.codefi.network/networks/1/gasPrices')
.thenCallback(() => {
return {
headers: { 'Access-Control-Allow-Origin': '*' },
statusCode: 200,
json: {
SafeGasPrice: '1',
ProposeGasPrice: '2',
FastGasPrice: '3',
},
};
});
testSpecificMock(server);
}
module.exports = { setupMocking };