-
-
Notifications
You must be signed in to change notification settings - Fork 279
Update PollingController to immediately call _executePoll if no polling is currently active for the key on start
#1874
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
0e810f9
123ebab
c4ab925
83a1b6e
b9e8740
b5dc78a
53c82dd
d4bc56f
a0b4354
c8085a3
e7d4bad
855f4b3
0d5aa6e
f3f6f51
3e0d40d
fa72da7
d690005
1cffb11
798b321
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1368,20 +1368,28 @@ describe('TokenListController', () => { | |
| ); | ||
|
|
||
| controller.startPollingByNetworkClientId('goerli'); | ||
| jest.advanceTimersByTime(pollingIntervalTime / 2); | ||
| jest.advanceTimersByTime(0); | ||
| await flushPromises(); | ||
| expect(fetchTokenListByChainIdSpy).toHaveBeenCalledTimes(0); | ||
| jest.advanceTimersByTime(pollingIntervalTime / 2); | ||
| await flushPromises(); | ||
|
|
||
| expect(fetchTokenListByChainIdSpy).toHaveBeenCalledTimes(1); | ||
| await Promise.all([ | ||
| jest.advanceTimersByTime(pollingIntervalTime / 2), | ||
| flushPromises(), | ||
| ]); | ||
| expect(fetchTokenListByChainIdSpy).toHaveBeenCalledTimes(1); | ||
| await Promise.all([ | ||
| jest.advanceTimersByTime(pollingIntervalTime / 2), | ||
| jest.runOnlyPendingTimers(), | ||
| flushPromises(), | ||
| ]); | ||
|
|
||
| expect(fetchTokenListByChainIdSpy).toHaveBeenCalledTimes(2); | ||
| await Promise.all([ | ||
| jest.advanceTimersByTime(pollingIntervalTime), | ||
| flushPromises(), | ||
| ]); | ||
|
|
||
| await Promise.all([jest.runOnlyPendingTimers(), flushPromises()]); | ||
| expect(fetchTokenListByChainIdSpy).toHaveBeenCalledTimes(2); | ||
| expect(fetchTokenListByChainIdSpy).toHaveBeenCalledTimes(3); | ||
| }); | ||
|
|
||
| it('should update tokenList state and tokensChainsCache', async () => { | ||
|
|
@@ -1441,7 +1449,7 @@ describe('TokenListController', () => { | |
| expect(controller.state).toStrictEqual(startingState); | ||
|
|
||
| // start polling for sepolia | ||
| await controller.startPollingByNetworkClientId('sepolia'); | ||
| const pollingToken = controller.startPollingByNetworkClientId('sepolia'); | ||
| // wait a polling interval | ||
| jest.advanceTimersByTime(pollingIntervalTime); | ||
| await flushPromises(); | ||
|
|
@@ -1457,10 +1465,10 @@ describe('TokenListController', () => { | |
| data: sampleSepoliaTokensChainCache, | ||
| }, | ||
| }); | ||
| controller.stopPollingByPollingToken(pollingToken); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: This test seems to do a lot. It's testing |
||
|
|
||
| // start polling for binance | ||
| await controller.startPollingByNetworkClientId( | ||
| 'binance-network-client-id', | ||
| ); | ||
| controller.startPollingByNetworkClientId('binance-network-client-id'); | ||
| jest.advanceTimersByTime(pollingIntervalTime); | ||
| await flushPromises(); | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.