mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
[ACA-2040] show different email invalid error messages (#862)
This commit is contained in:
committed by
Denys Vuika
parent
b2244cb1c4
commit
904c08461d
@@ -179,5 +179,35 @@ describe('LibraryMembershipDirective', () => {
|
||||
tick();
|
||||
expect(directive.error.emit).toHaveBeenCalled();
|
||||
}));
|
||||
|
||||
it('should emit specific error message on invalid email address server error', fakeAsync(() => {
|
||||
const emitErrorSpy = spyOn(directive.error, 'emit');
|
||||
const selection = { entry: { id: 'no-membership-requested' } };
|
||||
const change = new SimpleChange(null, selection, true);
|
||||
directive.ngOnChanges({ selection: change });
|
||||
tick();
|
||||
|
||||
const testData = [
|
||||
{
|
||||
fixture: 'Failed to resolve sender mail address',
|
||||
expected: 'APP.MESSAGES.ERRORS.INVALID_SENDER_EMAIL'
|
||||
},
|
||||
{
|
||||
fixture: 'All recipients for the mail action were invalid',
|
||||
expected: 'APP.MESSAGES.ERRORS.INVALID_RECEIVER_EMAIL'
|
||||
}
|
||||
];
|
||||
|
||||
testData.forEach(data => {
|
||||
addMembershipSpy.and.returnValue(throwError({ message: data.fixture }));
|
||||
emitErrorSpy.calls.reset();
|
||||
directive.toggleMembershipRequest();
|
||||
tick();
|
||||
expect(emitErrorSpy).toHaveBeenCalledWith({
|
||||
error: { message: data.fixture },
|
||||
i18nKey: data.expected
|
||||
});
|
||||
});
|
||||
}));
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user