import { CreateAccountHandler } from '../../../../../src/identity/interaction/account/CreateAccountHandler'; import type { AccountStore } from '../../../../../src/identity/interaction/account/util/AccountStore'; import { createAccount, mockAccountStore } from '../../../../util/AccountUtil'; describe('A CreateAccountHandler', (): void => { let accountStore: jest.Mocked; let handler: CreateAccountHandler; beforeEach(async(): Promise => { accountStore = mockAccountStore(); handler = new CreateAccountHandler(accountStore, {} as any, {} as any); }); it('has no requirements.', async(): Promise => { await expect(handler.getView()).resolves.toEqual({ json: {}}); }); it('returns the identifier of the newly created account.', async(): Promise => { const account = createAccount('custom'); accountStore.create.mockResolvedValueOnce(account); await expect(handler.login()).resolves.toEqual({ json: { accountId: 'custom' }}); }); });