Joachim Van Herwegen cc1c3d9223 feat: Support JSON errors
The IDP behaviour has been changed to move all error related knowledge
to the IdentityProviderHttpHandler instead of managing it
in the Interactionhandlers.
2021-09-08 13:55:52 +02:00

17 lines
894 B
TypeScript

import {
assertPassword,
} from '../../../../../src/identity/interaction/email-password/EmailPasswordUtil';
describe('EmailPasswordUtil', (): void => {
describe('#assertPassword', (): void => {
it('validates the password against the confirmPassword.', async(): Promise<void> => {
expect((): void => assertPassword(undefined, undefined)).toThrow('Please enter a password.');
expect((): void => assertPassword([], undefined)).toThrow('Please enter a password.');
expect((): void => assertPassword('password', undefined)).toThrow('Please confirm your password.');
expect((): void => assertPassword('password', [])).toThrow('Please confirm your password.');
expect((): void => assertPassword('password', 'other')).toThrow('Your password and confirmation did not match');
expect(assertPassword('password', 'password')).toBeUndefined();
});
});
});