Skip to content

Commit

Permalink
Remove polling start call in detection controllers' constructors (#629)
Browse files Browse the repository at this point in the history
* Remove polling start call in detection controllers' constructors
  • Loading branch information
adonesky1 authored Nov 10, 2021
1 parent f0d6b22 commit 4e293b3
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/assets/CollectibleDetectionController.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ describe('CollectibleDetectionController', () => {
CollectibleDetectionController.prototype,
'detectCollectibles',
);
new CollectibleDetectionController(
const collectiblesDetectionController = new CollectibleDetectionController(
{
onCollectiblesStateChange: (listener) =>
collectiblesController.subscribe(listener),
Expand All @@ -219,6 +219,8 @@ describe('CollectibleDetectionController', () => {
},
{ interval: 10 },
);
collectiblesDetectionController.start();

expect(mockCollectibles.calledOnce).toBe(true);
setTimeout(() => {
expect(mockCollectibles.calledTwice).toBe(true);
Expand Down
1 change: 0 additions & 1 deletion src/assets/CollectibleDetectionController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,6 @@ export class CollectibleDetectionController extends BaseController<
});
this.getOpenSeaApiKey = getOpenSeaApiKey;
this.addCollectible = addCollectible;
this.start();
}

/**
Expand Down
4 changes: 3 additions & 1 deletion src/assets/TokenDetectionController.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ describe('TokenDetectionController', () => {
TokenDetectionController.prototype,
'detectTokens',
);
new TokenDetectionController(
const tokenDetectionController = new TokenDetectionController(
{
onTokensStateChange: (listener) =>
tokensController.subscribe(listener),
Expand All @@ -192,6 +192,8 @@ describe('TokenDetectionController', () => {
},
{ interval: 10 },
);
tokenDetectionController.start();

expect(mockTokens.calledOnce).toBe(true);
setTimeout(() => {
expect(mockTokens.calledTwice).toBe(true);
Expand Down
1 change: 0 additions & 1 deletion src/assets/TokenDetectionController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ export class TokenDetectionController extends BaseController<
this.configure({ networkType: provider.type });
});
this.getBalancesInSingleCall = getBalancesInSingleCall;
this.start();
}

/**
Expand Down

0 comments on commit 4e293b3

Please sign in to comment.