|
1 | 1 | import { subscriptions } from 'constants/storage.constants'; |
2 | 2 | import { WebsocketConnectionStatusEnum } from 'constants/websocket.constants'; |
| 3 | +import { getIsLoggedIn } from 'methods/account/getIsLoggedIn'; |
| 4 | +import { pendingTransactionsSessionsSelector } from 'store/selectors/transactionsSelector'; |
3 | 5 | import { websocketEventSelector } from 'store/selectors/accountSelectors'; |
4 | 6 | import { getStore } from 'store/store'; |
5 | 7 | import { SubscriptionsEnum } from 'types/subscriptions.type'; |
| 8 | +import { refreshAccount } from 'utils/account/refreshAccount'; |
6 | 9 | import { checkTransactionStatus } from '../helpers/checkTransactionStatus'; |
7 | 10 | import { getPollingInterval } from '../helpers/getPollingInterval'; |
8 | 11 | import { trackTransactions } from '../trackTransactions'; |
9 | 12 |
|
10 | 13 | // Mock all dependencies |
11 | 14 | jest.mock('store/store'); |
12 | 15 | jest.mock('store/selectors/accountSelectors'); |
| 16 | +jest.mock('store/selectors/transactionsSelector'); |
| 17 | +jest.mock('methods/account/getIsLoggedIn'); |
| 18 | +jest.mock('utils/account/refreshAccount'); |
13 | 19 | jest.mock('../helpers/checkTransactionStatus'); |
14 | 20 | jest.mock('../helpers/getPollingInterval'); |
15 | 21 |
|
16 | 22 | const mockGetStore = getStore as jest.MockedFunction<typeof getStore>; |
17 | 23 | const mockWebsocketEventSelector = |
18 | 24 | websocketEventSelector as jest.MockedFunction<typeof websocketEventSelector>; |
| 25 | +const mockPendingTransactionsSessionsSelector = |
| 26 | + pendingTransactionsSessionsSelector as jest.MockedFunction< |
| 27 | + typeof pendingTransactionsSessionsSelector |
| 28 | + >; |
| 29 | +const mockGetIsLoggedIn = getIsLoggedIn as jest.MockedFunction< |
| 30 | + typeof getIsLoggedIn |
| 31 | +>; |
| 32 | +const mockRefreshAccount = refreshAccount as jest.MockedFunction< |
| 33 | + typeof refreshAccount |
| 34 | +>; |
19 | 35 | const mockCheckTransactionStatus = |
20 | 36 | checkTransactionStatus as jest.MockedFunction<typeof checkTransactionStatus>; |
21 | 37 | const mockGetPollingInterval = getPollingInterval as jest.MockedFunction< |
@@ -62,6 +78,9 @@ describe('trackTransactions', () => { |
62 | 78 | timestamp: 1234567890, |
63 | 79 | message: 'test-message' |
64 | 80 | }); |
| 81 | + mockPendingTransactionsSessionsSelector.mockReturnValue({}); |
| 82 | + mockGetIsLoggedIn.mockReturnValue(false); |
| 83 | + mockRefreshAccount.mockResolvedValue(undefined); |
65 | 84 | mockCheckTransactionStatus.mockResolvedValue(undefined); |
66 | 85 | }); |
67 | 86 |
|
|
0 commit comments