Skip to content

Commit 1410d2c

Browse files
committed
test: use exportAccount instead of getAccounts
1 parent 82f124e commit 1410d2c

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

packages/keyring-controller/src/KeyringController.test.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3217,7 +3217,7 @@ describe('KeyringController', () => {
32173217
describe('atomic operations', () => {
32183218
describe('addNewKeyring', () => {
32193219
it('should rollback the controller keyrings if the keyring creation fails', async () => {
3220-
const mockAddress = '0x1234';
3220+
const mockAddress = '0x4584d2B4905087A100420AFfCe1b2d73fC69B8E4';
32213221
stubKeyringClassWithAccount(MockKeyring, mockAddress);
32223222
// Mocking the serialize method to throw an error will
32233223
// halt the controller everytime it tries to persist the keyring,
@@ -3234,12 +3234,11 @@ describe('KeyringController', () => {
32343234
controller.addNewKeyring(MockKeyring.type),
32353235
).rejects.toThrow('You will never be able to persist me!');
32363236

3237-
expect(controller.state.keyrings).toHaveLength(1);
3238-
// getAccounts calls each keyring to get its accounts
3239-
// resulting in an additional '0x1234' account being added
3240-
// in case of test failure
3241-
expect(await controller.getAccounts()).toStrictEqual(
3242-
initialState.keyrings[0].accounts,
3237+
expect(controller.state).toStrictEqual(initialState);
3238+
await expect(
3239+
controller.exportAccount(password, mockAddress),
3240+
).rejects.toThrow(
3241+
'KeyringController - No keyring found. Error info: There are keyrings, but none match the address',
32433242
);
32443243
},
32453244
);

0 commit comments

Comments
 (0)