Skip to content

Commit

Permalink
fix: mock jest in fiat test
Browse files Browse the repository at this point in the history
  • Loading branch information
limpbrains committed Dec 11, 2023
1 parent e36cbf2 commit 4904f35
Showing 1 changed file with 32 additions and 1 deletion.
33 changes: 32 additions & 1 deletion __tests__/fiat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,38 @@ import { getDisplayValues } from '../src/utils/displayValues';
import { resetExchangeRates } from '../src/store/actions/wallet';
import { EUnit } from '../src/store/types/wallet';

global.fetch = require('node-fetch');
// @ts-ignore
global.fetch = jest.fn(() =>
Promise.resolve({
json: () =>
Promise.resolve({
tickers: [
{
symbol: 'BTCRUB',
lastPrice: '3832499',
base: 'BTC',
baseName: 'Bitcoin',
quote: 'RUB',
quoteName: 'Russian Ruble',
currencySymbol: '₽',
currencyFlag: '🇷🇺',
lastUpdatedAt: 1702295587246,
},
{
symbol: 'BTCUSD',
lastPrice: '42373.00',
base: 'BTC',
baseName: 'Bitcoin',
quote: 'USD',
quoteName: 'US Dollar',
currencySymbol: '$',
currencyFlag: '🇺🇸',
lastUpdatedAt: 1702295629052,
},
],
}),
}),
);

describe('Pulls latest fiat exchange rates and checks the wallet store for valid conversions', () => {
jest.setTimeout(10000);
Expand Down

0 comments on commit 4904f35

Please sign in to comment.