@@ -118,19 +118,12 @@ describe('MoneyAccountService', () => {
118118 expect ( result ) . toStrictEqual ( { id : 'new-money-keyring-id' , name : '' } ) ;
119119 } ) ;
120120
121- it ( 'returns existing money keyring metadata if a money account already exists' , async ( ) => {
121+ it ( 'returns null if a money account already exists' , async ( ) => {
122122 const { service, mocks } = setup ( ) ;
123- const MOCK_MONEY_METADATA = { id : 'existing-money-keyring-id' , name : '' } ;
124- const MOCK_MONEY_ADDRESS = '0x1234567890abcdef1234567890abcdef12345678' ;
125123
126124 mocks . withKeyring . mockImplementation ( async ( selector , operation ) => {
127125 if ( 'type' in selector && selector . type === KeyringTypes . money ) {
128- return operation ( {
129- keyring : {
130- getAccounts : jest . fn ( ) . mockResolvedValue ( [ MOCK_MONEY_ADDRESS ] ) ,
131- } ,
132- metadata : MOCK_MONEY_METADATA ,
133- } ) ;
126+ return operation ( ) ;
134127 }
135128 return operation ( {
136129 keyring : {
@@ -143,38 +136,10 @@ describe('MoneyAccountService', () => {
143136
144137 const result = await service . createMoneyAccount ( MOCK_ENTROPY_SOURCE ) ;
145138
146- expect ( result ) . toStrictEqual ( MOCK_MONEY_METADATA ) ;
139+ expect ( result ) . toBeNull ( ) ;
147140 expect ( mocks . addNewKeyring ) . not . toHaveBeenCalled ( ) ;
148141 } ) ;
149142
150- it ( 'creates a new money keyring if an existing one has no accounts' , async ( ) => {
151- const { service, mocks } = setup ( ) ;
152-
153- mocks . withKeyring . mockImplementation ( async ( selector , operation ) => {
154- if ( 'type' in selector && selector . type === KeyringTypes . money ) {
155- return operation ( {
156- keyring : {
157- getAccounts : jest . fn ( ) . mockResolvedValue ( [ ] ) ,
158- } ,
159- metadata : { id : 'empty-money-keyring-id' , name : '' } ,
160- } ) ;
161- }
162- return operation ( {
163- keyring : {
164- type : 'HD Key Tree' ,
165- mnemonic : MOCK_MNEMONIC ,
166- } as unknown as HdKeyring ,
167- metadata : { id : MOCK_ENTROPY_SOURCE , name : '' } ,
168- } ) ;
169- } ) ;
170-
171- await service . createMoneyAccount ( MOCK_ENTROPY_SOURCE ) ;
172-
173- expect ( mocks . addNewKeyring ) . toHaveBeenCalledWith ( KeyringTypes . money , {
174- mnemonic : MOCK_MNEMONIC ,
175- } ) ;
176- } ) ;
177-
178143 it ( 're-throws errors other than KeyringNotFound when checking for an existing money keyring' , async ( ) => {
179144 const { service, mocks } = setup ( ) ;
180145 const unexpectedError = new KeyringControllerError ( 'Unexpected error' ) ;
0 commit comments