Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion packages/keyring-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@
"deepmerge": "^4.2.2",
"jest": "^29.7.0",
"jest-environment-node": "^29.7.0",
"sinon": "^9.2.4",
"ts-jest": "^29.2.5",
"typedoc": "^0.25.13",
"typedoc-plugin-missing-exports": "^2.0.0",
Expand Down
20 changes: 9 additions & 11 deletions packages/keyring-controller/src/KeyringController.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import type {
import { wordlist } from '@metamask/scure-bip39/dist/wordlists/english';
import { bytesToHex, isValidHexAddress } from '@metamask/utils';
import type { Hex } from '@metamask/utils';
import sinon from 'sinon';

import { KeyringControllerErrorMessage } from './constants';
import { KeyringControllerError } from './errors';
Expand Down Expand Up @@ -135,7 +134,6 @@ function createVault(keyrings: SerializedKeyring[] = defaultKeyrings): string {

describe('KeyringController', () => {
afterEach(() => {
sinon.restore();
jest.resetAllMocks();
});

Expand Down Expand Up @@ -838,10 +836,10 @@ describe('KeyringController', () => {

it('should emit KeyringController:lock event', async () => {
await withController(async ({ controller, messenger }) => {
const listener = sinon.spy();
const listener = jest.fn();
messenger.subscribe('KeyringController:lock', listener);
await controller.setLocked();
expect(listener.called).toBe(true);
expect(listener).toHaveBeenCalled();
});
});

Expand Down Expand Up @@ -1617,13 +1615,13 @@ describe('KeyringController', () => {
AccountImportStrategy.privateKey,
[privateKey],
);
const listener = sinon.spy();
const listener = jest.fn();
messenger.subscribe('KeyringController:accountRemoved', listener);

const removedAccount = '0x51253087e6f8358b5f10c0a94315d69db3357859';
await controller.removeAccount(removedAccount);

expect(listener.calledWith(removedAccount)).toBe(true);
expect(listener).toHaveBeenCalledWith(removedAccount);
});
});

Expand Down Expand Up @@ -2785,10 +2783,10 @@ describe('KeyringController', () => {

it('should emit KeyringController:unlock event', async () => {
await withController(async ({ controller, messenger }) => {
const listener = sinon.spy();
const listener = jest.fn();
messenger.subscribe('KeyringController:unlock', listener);
await controller.submitPassword(password);
expect(listener.called).toBe(true);
expect(listener).toHaveBeenCalled();
});
});

Expand Down Expand Up @@ -3533,9 +3531,9 @@ describe('KeyringController', () => {
describe('when wrong password is provided', () => {
it('should throw an error', async () => {
await withController(async ({ controller, encryptor }) => {
sinon
.stub(encryptor, 'decrypt')
.rejects(new Error('Incorrect password'));
jest
.spyOn(encryptor, 'decrypt')
.mockRejectedValue(new Error('Incorrect password'));

await expect(controller.verifyPassword('12341234')).rejects.toThrow(
'Incorrect password',
Expand Down
1 change: 0 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3850,7 +3850,6 @@ __metadata:
jest: "npm:^29.7.0"
jest-environment-node: "npm:^29.7.0"
lodash: "npm:^4.17.21"
sinon: "npm:^9.2.4"
ts-jest: "npm:^29.2.5"
typedoc: "npm:^0.25.13"
typedoc-plugin-missing-exports: "npm:^2.0.0"
Expand Down