Skip to content

Commit

Permalink
feat: add mock alex prices
Browse files Browse the repository at this point in the history
  • Loading branch information
alter-eggo authored and kyranjamie committed Nov 25, 2024
1 parent 95cc7c9 commit 56502b7
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 4 deletions.
19 changes: 18 additions & 1 deletion tests/mocks/mock-alex-assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,27 @@ const mockedAlexPools = [
},
];

export async function mockMainnetTestAccountAlexAssetsRequest(page: Page) {
const mockedAlexTokenPrices = [
{
contract_id: 'SP265WBWD4NH7TVPYQTVD23X3607NNK4484DTXQZ3.longcoin',
last_price_usd: 4.23105713004e-7,
},
{
contract_id: 'SP32AEEF6WW5Y0NMJ1S8SBSZDAY8R5J32NBZFPKKZ.nope',
last_price_usd: 0.000046211724535772,
},
];

export async function mockMainnetAlexAssetsRequest(page: Page) {
await page.route('https://alex-sdk-api.alexlab.co/', route =>
route.fulfill({
json: { pools: mockedAlexPools, tokens: mockedAlexTokens },
})
);
}

export async function mockMainnetAlexTokenPricesRequest(page: Page) {
await page.route('https://api.alexgo.io/v2/public/token-prices', route =>
route.fulfill({ json: { data: mockedAlexTokenPrices } })
);
}
8 changes: 6 additions & 2 deletions tests/mocks/mock-apis.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { Page } from '@playwright/test';
import { json } from '@tests/utils';

import { mockMainnetTestAccountAlexAssetsRequest } from './mock-alex-assets';
import {
mockMainnetAlexAssetsRequest,
mockMainnetAlexTokenPricesRequest,
} from './mock-alex-assets';
import { mockMainnetTestAccountBrc20TokensRequest } from './mock-brc20';
import { mockMainnetTestAccountRunesOutputsRequest } from './mock-runes';
import { mockMainnetTestAccountStampchainRequest } from './mock-src20';
Expand All @@ -27,7 +30,8 @@ export async function setupMockApis(page: Page) {
mockMainnetTestAccountStacksNFTsRequest(page),
mockMainnetTestAccountStacksFTsRequest(page),
mockMainnetTestAccountStacksBalancesRequest(page),
mockMainnetTestAccountAlexAssetsRequest(page),
mockMainnetAlexAssetsRequest(page),
mockMainnetAlexTokenPricesRequest(page),

mockMainnetTestAccountStampchainRequest(page),
mockMainnetTestAccountBrc20TokensRequest(page),
Expand Down
1 change: 0 additions & 1 deletion tests/specs/manage-tokens/manage-tokens.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ test.describe('Manage tokens', () => {
test.beforeEach(async ({ extensionId, globalPage, onboardingPage }) => {
await globalPage.setupAndUseApiCalls(extensionId);
await onboardingPage.signInWithTestAccount(extensionId);
await globalPage.page.waitForLoadState('networkidle');
});

test('that supported sip10 token is shown', async ({ homePage }) => {
Expand Down

0 comments on commit 56502b7

Please sign in to comment.