|
| 1 | +import { EthAccountType } from '@metamask/keyring-api'; |
| 2 | + |
| 3 | +import { createMockInternalAccount } from './mocks'; |
| 4 | + |
| 5 | +describe('createMockInternalAccount', () => { |
| 6 | + it('should create a mock internal account', () => { |
| 7 | + const account = createMockInternalAccount(); |
| 8 | + expect(account).toStrictEqual({ |
| 9 | + id: expect.any(String), |
| 10 | + address: expect.any(String), |
| 11 | + type: expect.any(String), |
| 12 | + options: expect.any(Object), |
| 13 | + methods: expect.any(Array), |
| 14 | + metadata: { |
| 15 | + name: expect.any(String), |
| 16 | + keyring: { type: expect.any(String) }, |
| 17 | + importTime: expect.any(Number), |
| 18 | + lastSelected: expect.any(Number), |
| 19 | + snap: undefined, |
| 20 | + }, |
| 21 | + }); |
| 22 | + }); |
| 23 | + |
| 24 | + it('should create a mock internal account with custom values', () => { |
| 25 | + const customSnap = { |
| 26 | + id: '1', |
| 27 | + enabled: true, |
| 28 | + name: 'Snap 1', |
| 29 | + }; |
| 30 | + const account = createMockInternalAccount({ |
| 31 | + id: '1', |
| 32 | + address: '0x123', |
| 33 | + type: EthAccountType.Erc4337, |
| 34 | + name: 'Custom Account', |
| 35 | + snap: customSnap, |
| 36 | + }); |
| 37 | + expect(account).toStrictEqual({ |
| 38 | + id: '1', |
| 39 | + address: '0x123', |
| 40 | + type: EthAccountType.Erc4337, |
| 41 | + options: expect.any(Object), |
| 42 | + methods: expect.any(Array), |
| 43 | + metadata: { |
| 44 | + name: 'Custom Account', |
| 45 | + keyring: { type: expect.any(String) }, |
| 46 | + importTime: expect.any(Number), |
| 47 | + lastSelected: expect.any(Number), |
| 48 | + snap: customSnap, |
| 49 | + }, |
| 50 | + }); |
| 51 | + }); |
| 52 | +}); |
0 commit comments