mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-25 20:02:58 +01:00
ebeb2668ea
* mock gas price api * fix error * full url * remove duplicated packages * full url * customise mock per test * customise mock per test * enable mocking * enable mocking * enable mocking by default * duplicated packages * update mockttp * pass through * pass through
33 lines
852 B
JavaScript
33 lines
852 B
JavaScript
function setupMocking(server) {
|
|
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',
|
|
},
|
|
};
|
|
});
|
|
}
|
|
|
|
module.exports = { setupMocking };
|