Skip to content

Commit 4904f35

Browse files
committed
fix: mock jest in fiat test
1 parent e36cbf2 commit 4904f35

File tree

1 file changed

+32
-1
lines changed

1 file changed

+32
-1
lines changed

__tests__/fiat.ts

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,38 @@ import { getDisplayValues } from '../src/utils/displayValues';
55
import { resetExchangeRates } from '../src/store/actions/wallet';
66
import { EUnit } from '../src/store/types/wallet';
77

8-
global.fetch = require('node-fetch');
8+
// @ts-ignore
9+
global.fetch = jest.fn(() =>
10+
Promise.resolve({
11+
json: () =>
12+
Promise.resolve({
13+
tickers: [
14+
{
15+
symbol: 'BTCRUB',
16+
lastPrice: '3832499',
17+
base: 'BTC',
18+
baseName: 'Bitcoin',
19+
quote: 'RUB',
20+
quoteName: 'Russian Ruble',
21+
currencySymbol: '₽',
22+
currencyFlag: '🇷🇺',
23+
lastUpdatedAt: 1702295587246,
24+
},
25+
{
26+
symbol: 'BTCUSD',
27+
lastPrice: '42373.00',
28+
base: 'BTC',
29+
baseName: 'Bitcoin',
30+
quote: 'USD',
31+
quoteName: 'US Dollar',
32+
currencySymbol: '$',
33+
currencyFlag: '🇺🇸',
34+
lastUpdatedAt: 1702295629052,
35+
},
36+
],
37+
}),
38+
}),
39+
);
940

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

0 commit comments

Comments
 (0)