Skip to content

Commit

Permalink
chore: add expected swaps-api send query
Browse files Browse the repository at this point in the history
  • Loading branch information
micaelae committed Jun 14, 2024
1 parent 7675962 commit b3166bb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions test/e2e/tests/swap-send/swap-send-erc20.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ describe('Swap-Send ERC20', function () {
getSwapSendFixtures(
this.test?.fullTitle(),
SWAP_SEND_QUOTES_RESPONSE_TST_ETH,
'?sourceAmount=100000&sourceToken=0x581c3C1A2A4EBDE2A0Df29B5cf4c116E42945947&destinationToken=0x0000000000000000000000000000000000000000&sender=0x5cfe73b6021e818b776b421b1c4db2474086a7e1&recipient=0xc427D562164062a23a5cFf596A4a3208e72Acd28&slippage=2',
),
async ({
driver,
Expand Down
8 changes: 5 additions & 3 deletions test/e2e/tests/swap-send/swap-send-test-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,10 +245,11 @@ export class SwapSendPage {
}

export const mockSwapsApi =
(quotes = SWAP_SEND_QUOTES_RESPONSE_ETH_TST) =>
(quotes: typeof SWAP_SEND_QUOTES_RESPONSE_ETH_TST, query: string) =>
async (mockServer: Mockttp) => {
return await mockServer
await mockServer
.forGet(`${SWAPS_API_V2_BASE_URL}/v2/networks/1337/quotes`)
.withExactQuery(query)
.always()
.thenCallback(() => {
return {
Expand All @@ -261,6 +262,7 @@ export const mockSwapsApi =
export const getSwapSendFixtures = (
title?: string,
swapsQuotes = SWAP_SEND_QUOTES_RESPONSE_ETH_TST,
swapsQuery = '?sourceAmount=1000000000000000000&sourceToken=0x0000000000000000000000000000000000000000&destinationToken=0x581c3C1A2A4EBDE2A0Df29B5cf4c116E42945947&sender=0x5cfe73b6021e818b776b421b1c4db2474086a7e1&recipient=0xc427D562164062a23a5cFf596A4a3208e72Acd28&slippage=2',
) => {
const ETH_CONVERSION_RATE_USD = 3010;
return {
Expand Down Expand Up @@ -296,7 +298,7 @@ export const getSwapSendFixtures = (
.build(),
smartContract: SMART_CONTRACTS.HST,
ethConversionInUsd: ETH_CONVERSION_RATE_USD,
testSpecificMock: mockSwapsApi(swapsQuotes),
testSpecificMock: mockSwapsApi(swapsQuotes, swapsQuery),
ganacheOptions: generateGanacheOptions({ hardfork: 'london' }),
title,
};
Expand Down

0 comments on commit b3166bb

Please sign in to comment.