@@ -40,6 +40,18 @@ type MockTruncatedSnap = Pick<
4040 'id' | 'initialPermissions' | 'enabled' | 'blocked'
4141> ;
4242
43+ /** Mock account group type for tests. */
44+ type MockAccountGroup = Pick < AccountGroupObject , 'id' | 'accounts' > ;
45+
46+ /** Mock Snap keyring type for tests. */
47+ type MockSnapKeyring = {
48+ type : KeyringTypes . snap ;
49+ handleKeyringSnapMessage ?: jest . MockedFunction <
50+ SnapKeyring [ 'handleKeyringSnapMessage' ]
51+ > ;
52+ setSelectedAccounts ?: jest . MockedFunction < SnapKeyring [ 'setSelectedAccounts' ] > ;
53+ } ;
54+
4355type Mocks = {
4456 // eslint-disable-next-line @typescript-eslint/naming-convention
4557 SnapController : {
@@ -213,7 +225,7 @@ function buildGroup(
213225 id : AccountGroupId ,
214226 accounts : string [ ] ,
215227) : AccountGroupObject {
216- return { id, accounts } as unknown as AccountGroupObject ;
228+ return { id, accounts } as MockAccountGroup as AccountGroupObject ;
217229}
218230
219231/**
@@ -326,7 +338,7 @@ function mockLegacySnapKeyring(
326338 > ;
327339 } ,
328340) : void {
329- const snapKeyring = {
341+ const snapKeyring : MockSnapKeyring = {
330342 type : KeyringTypes . snap ,
331343 handleKeyringSnapMessage,
332344 setSelectedAccounts,
@@ -336,7 +348,7 @@ function mockLegacySnapKeyring(
336348 get keyrings ( ) {
337349 return Object . freeze ( [
338350 {
339- keyring : snapKeyring as unknown as KeyringEntry [ 'keyring' ] ,
351+ keyring : snapKeyring as KeyringEntry [ 'keyring' ] ,
340352 metadata : { id : 'id-snap' , name : KeyringTypes . snap } ,
341353 } ,
342354 ] ) ;
0 commit comments