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

Add validation for the fee property from the /trades API response (#10836)

This commit is contained in:
Daniel 2021-04-06 17:19:55 -07:00 committed by GitHub
parent 501829e5ca
commit 135f0bb4f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 0 deletions

View File

@ -101,6 +101,7 @@ export const MOCK_TRADE_RESPONSE_1 = [
sourceAmount: '10000000000000000',
destinationAmount: '2248687',
error: null,
fee: 0.875,
sourceToken: TOKENS[0].address,
destinationToken: TOKENS[1].address,
fetchTime: 553,

View File

@ -131,6 +131,10 @@ const QUOTE_VALIDATORS = [
type: 'number|undefined',
validator: (gasEstimate) => gasEstimate === undefined || gasEstimate > 0,
},
{
property: 'fee',
type: 'number',
},
];
const TOKEN_VALIDATORS = [

View File

@ -64,6 +64,7 @@ describe('Swaps Util', function () {
sourceAmount: '10000000000000000',
destinationAmount: '2248687',
error: null,
fee: 0.875,
sourceToken: TOKENS[0].address,
destinationToken: TOKENS[1].address,
fetchTime: 553,