Skip to content

Commit 80e0e50

Browse files
committed
test: add case to check that metadata is readonly
1 parent f4bee6b commit 80e0e50

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,16 @@ describe('KeyringController', () => {
437437
expect(controller.state.keyrings).toHaveLength(2);
438438
});
439439
});
440+
441+
it('should return a readonly object as metadata', async () => {
442+
await withController(async ({ controller }) => {
443+
const newMetadata = await controller.addNewKeyring(KeyringTypes.hd);
444+
445+
expect(() => {
446+
newMetadata.name = 'new name';
447+
}).toThrow(/Cannot assign to read only property 'name'/u);
448+
});
449+
});
440450
});
441451

442452
describe('when there is no builder for the given type', () => {

0 commit comments

Comments
 (0)