mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00

The previous package was outdated, preventing us from updating TS. This one also lints YAML and JSON, and applies many more rules to the test files, explaining all the changes in this PR.
26 lines
979 B
TypeScript
26 lines
979 B
TypeScript
import { CreateAccountHandler } from '../../../../../src/identity/interaction/account/CreateAccountHandler';
|
|
import type { AccountStore } from '../../../../../src/identity/interaction/account/util/AccountStore';
|
|
|
|
describe('A CreateAccountHandler', (): void => {
|
|
const accountId = 'accountId';
|
|
let accountStore: jest.Mocked<AccountStore>;
|
|
let handler: CreateAccountHandler;
|
|
|
|
beforeEach(async(): Promise<void> => {
|
|
accountStore = {
|
|
create: jest.fn().mockResolvedValue(accountId),
|
|
} satisfies Partial<AccountStore> as any;
|
|
|
|
handler = new CreateAccountHandler(accountStore, {} as any);
|
|
});
|
|
|
|
it('has no requirements.', async(): Promise<void> => {
|
|
await expect(handler.getView()).resolves.toEqual({ json: {}});
|
|
});
|
|
|
|
it('returns the identifier of the newly created account.', async(): Promise<void> => {
|
|
await expect(handler.login()).resolves.toEqual({ json: { accountId }});
|
|
expect(accountStore.create).toHaveBeenCalledTimes(1);
|
|
});
|
|
});
|