Skip to content

Commit

Permalink
test: remove old not working coingecko stubs
Browse files Browse the repository at this point in the history
  • Loading branch information
davidyuk committed Feb 13, 2025
1 parent 5143b68 commit 91e8cb5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 19 deletions.
10 changes: 1 addition & 9 deletions src/constants/stubs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,7 @@ import type {
PopupType,
TxFunctionParsed,
} from '@/types';
import { CoinGeckoMarketResponse } from '@/lib/CoinGecko';
import {
AE_COINGECKO_COIN_ID,
AE_CONTRACT_ID,
} from '@/protocols/aeternity/config';
import { AE_CONTRACT_ID } from '@/protocols/aeternity/config';
import {
POPUP_TYPE_ACCOUNT_LIST,
POPUP_TYPE_CONNECT,
Expand Down Expand Up @@ -50,10 +46,6 @@ export const STUB_ACCOUNT = {
export const recipientId: Encoded.AccountAddress = 'ak_2ELPCWzcTdiyYuumjaV4D7kE843d1Ts27zH1Y2LBMKDbNtfq1Q';
export const contractCallAddress: Encoded.ContractAddress = 'ct_ym8eXWR2YfQZcMaXA8GFid9aarfCozGkeMcRHYVCVoBdVMzio';

export const STUB_CURRENCY: CoinGeckoMarketResponse = {
id: AE_COINGECKO_COIN_ID, symbol: 'ae', name: 'Aeternity', image: 'https://assets.coingecko.com/coins/images/1091/large/aeternity.png?1547035060', currentPrice: 0.076783, marketCap: 31487891, marketCapRank: 523, fullyDilutedValuation: null, totalVolume: 217034, high24h: 0.078539, low24h: 0.076793, priceChange24h: -0.001092194951687525, priceChangePercentage24h: -1.4025, marketCapChange24h: -429134.39267925173, marketCapChangePercentage24h: -1.34453, circulatingSupply: 409885828.49932, totalSupply: 536306702.0, maxSupply: null, ath: 5.69, athChangePercentage: -98.65091, athDate: '2018-04-29T03:50:39.593Z', atl: 0.059135, atlChangePercentage: 29.84246, atlDate: '2020-03-13T02:29:11.856Z', roi: { times: -0.725775445642378, currency: 'usd', percentage: -72.57754456423778 }, lastUpdated: '2023-01-17T11:38:23.610Z',
};

export const STUB_APP_DATA: IAppData = {
href: 'http://localhost:5000/aepp/aepp',
name: 'AEPP',
Expand Down
12 changes: 2 additions & 10 deletions tests/e2e/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
PROTOCOLS,
STORAGE_KEYS,
} from '@/constants';
import { STUB_CURRENCY, STUB_ACCOUNT } from '@/constants/stubs';
import { STUB_ACCOUNT } from '@/constants/stubs';
import {
generateEncryptionKey,
encrypt,
Expand All @@ -16,7 +16,6 @@ import {
generateSalt,
prepareStorageKey,
} from '@/utils';
import { CoinGecko } from '../../../src/lib/CoinGecko';

export function preparePendingTransactionToLocalStorage(pendingTransaction) {
const { address } = STUB_ACCOUNT;
Expand Down Expand Up @@ -73,11 +72,6 @@ Cypress.Commands.add('shouldHasErrorMessage', (el) => {
cy.get(el).should('exist').should('be.visible');
});

Cypress.Commands.add('mockExternalRequests', () => {
cy.stub(CoinGecko, 'fetchCoinMarketData', STUB_CURRENCY);
cy.stub(CoinGecko, 'fetchCoinCurrencyRates', { usd: 0.05 });
});

Cypress.Commands.add('loginUsingPassword', () => {
cy.get('[data-cy=password] input')
.should('be.visible')
Expand All @@ -87,15 +81,13 @@ Cypress.Commands.add('loginUsingPassword', () => {
.click();
});

Cypress.Commands.add('login', (options, route, isMockingExternalRequests = true) => {
Cypress.Commands.add('login', (options, route) => {
cy.then(async () => {
const salt = generateSalt();
const encryptionKey = await generateEncryptionKey(STUB_ACCOUNT.password, salt);
const mnemonicEncryptionResult = await encrypt(encryptionKey, STUB_ACCOUNT.mnemonic);
return [mnemonicEncryptionResult, salt];
}).then(([mnemonicEncryptionResult, salt]) => {
if (isMockingExternalRequests) cy.mockExternalRequests();

const { isSeedBackedUp = false, pendingTransaction, network = null } = options || {};

cy.openPopup(async (contentWindow) => {
Expand Down

0 comments on commit 91e8cb5

Please sign in to comment.