Skip to content

Commit

Permalink
test: add case for lock event
Browse files Browse the repository at this point in the history
  • Loading branch information
mikesposito committed Sep 18, 2023
1 parent db3bd03 commit c3ca98c
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions app/scripts/controllers/detect-tokens.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,25 @@ describe('DetectTokensController', function () {
messenger.publish('KeyringController:unlock');

sandbox.assert.called(stub);
assert.equal(controller.isUnlocked, true);
});

it('should not be active after lock event is emitted', async function () {
sandbox.useFakeTimers();
const controller = new DetectTokensController({
messenger: getRestrictedMessenger(),
preferences,
network,
tokenList: tokenListController,
tokensController,
assetsContractController,
});
controller.isOpen = true;

messenger.publish('KeyringController:lock');

assert.equal(controller.isUnlocked, false);
assert.equal(controller.isActive, false);
});

it('should not trigger detect new tokens when not unlocked', async function () {
Expand Down

0 comments on commit c3ca98c

Please sign in to comment.