mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
* clearing error message when upload component mounts * fixing tests
This commit is contained in:
parent
97cf9c4a06
commit
498c054f89
2 changed files with 11 additions and 5 deletions
|
@ -54,22 +54,25 @@ describe('UploadLicense', () => {
|
|||
services.kbnUrl.change.mockReset();
|
||||
});
|
||||
it('should display an error when submitting invalid JSON', async () => {
|
||||
store.dispatch(uploadLicense('INVALID', 'trial'));
|
||||
const rendered = mount(component);
|
||||
store.dispatch(uploadLicense('INVALID', 'trial'));
|
||||
rendered.update();
|
||||
expect(rendered).toMatchSnapshot();
|
||||
});
|
||||
it('should display an error when ES says license is invalid', async () => {
|
||||
const rendered = mount(component);
|
||||
const invalidLicense = JSON.stringify({ license: { type: 'basic' } });
|
||||
server.respond(UPLOAD_LICENSE_INVALID);
|
||||
await uploadLicense(invalidLicense)(store.dispatch, null, services);
|
||||
const rendered = mount(component);
|
||||
rendered.update();
|
||||
expect(rendered).toMatchSnapshot();
|
||||
});
|
||||
it('should display an error when ES says license is expired', async () => {
|
||||
const rendered = mount(component);
|
||||
const invalidLicense = JSON.stringify({ license: { type: 'basic' } });
|
||||
server.respond(UPLOAD_LICENSE_EXPIRED);
|
||||
await uploadLicense(invalidLicense)(store.dispatch, null, services);
|
||||
const rendered = mount(component);
|
||||
rendered.update();
|
||||
expect(rendered).toMatchSnapshot();
|
||||
});
|
||||
it('should display a modal when license requires acknowledgement', async () => {
|
||||
|
@ -93,10 +96,11 @@ describe('UploadLicense', () => {
|
|||
expect(services.kbnUrl.change).toHaveBeenCalledWith(BASE_PATH);
|
||||
});
|
||||
it('should display error when ES returns error', async () => {
|
||||
const rendered = mount(component);
|
||||
const license = JSON.stringify({ license: { type: 'basic' } });
|
||||
server.respond(UPLOAD_LICENSE_TLS_NOT_ENABLED);
|
||||
await uploadLicense(license)(store.dispatch, null, services);
|
||||
const rendered = mount(component);
|
||||
rendered.update();
|
||||
expect(rendered).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -22,6 +22,9 @@ import {
|
|||
} from '@elastic/eui';
|
||||
|
||||
export class UploadLicense extends React.PureComponent {
|
||||
componentDidMount() {
|
||||
this.props.addUploadErrorMessage('');
|
||||
}
|
||||
send = acknowledge => {
|
||||
const file = this.file;
|
||||
const fr = new FileReader();
|
||||
|
@ -89,7 +92,6 @@ export class UploadLicense extends React.PureComponent {
|
|||
this.props.addUploadErrorMessage('You must select a license file.');
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
const { currentLicenseType, applying } = this.props;
|
||||
return (
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue