Minor: make password and username field non required in email config form (#16133)

* Minor: make password field as non required in email config form

* chore: Update email config form to make password field non-required
This commit is contained in:
Sachin Chaurasiya 2024-05-06 19:25:34 +05:30 committed by GitHub
parent 0769d71ee7
commit b04837cdeb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 26 additions and 9 deletions

View File

@ -52,5 +52,5 @@
}
},
"additionalProperties": false,
"required": ["serverEndpoint", "serverPort", "username", "password", "senderMail", "openMetadataUrl"]
"required": ["serverEndpoint", "serverPort", "senderMail", "openMetadataUrl"]
}

View File

@ -49,16 +49,10 @@ function EmailConfigForm({
validateMessages={VALIDATION_MESSAGES}
onFinish={onSubmit}
onFocus={onFocus}>
<Item
label={t('label.username')}
name="username"
rules={[{ required: true }]}>
<Item label={t('label.username')} name="username">
<Input data-testid="username-input" id="root/username" />
</Item>
<Item
label={t('label.password')}
name="password"
rules={[{ required: true }]}>
<Item label={t('label.password')} name="password">
<Input
data-testid="password-input"
id="root/password"

View File

@ -144,4 +144,27 @@ describe('Email Config Form Component', () => {
expect(mockOnSubmit).not.toHaveBeenCalled();
});
it('should call onSubmit if password and username is not filled', async () => {
render(
<EmailConfigForm
{...mockProps}
emailConfigValues={{
...emailConfigValues,
password: '',
username: '',
}}
/>
);
await act(async () => {
fireEvent.click(screen.getByText('label.submit'));
});
expect(mockOnSubmit).toHaveBeenCalledWith({
...emailConfigValues,
password: '',
username: '',
});
});
});