mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[ML] Fixes jest tests for bucket span estimator button. (#19164)
Fixes jest tests for the bucket span estimator button. The tests were not correctly considering the way jest runs tests asynchronously. Now each test is self-contained within the test callback.
This commit is contained in:
parent
69b857ca54
commit
72083c9b0c
2 changed files with 17 additions and 20 deletions
|
@ -10,15 +10,15 @@ exports[`BucketSpanEstimator renders the button 1`] = `
|
|||
>
|
||||
<EuiButton
|
||||
color="primary"
|
||||
disabled={true}
|
||||
disabled={false}
|
||||
fill={true}
|
||||
iconSide="right"
|
||||
isLoading={true}
|
||||
isLoading={false}
|
||||
onClick={[Function]}
|
||||
size="s"
|
||||
type="button"
|
||||
>
|
||||
Estimating bucket span
|
||||
Estimate bucket span
|
||||
</EuiButton>
|
||||
</EuiToolTip>
|
||||
</div>
|
||||
|
|
|
@ -10,29 +10,26 @@ import React from 'react';
|
|||
import { BucketSpanEstimator } from './bucket_span_estimator_view';
|
||||
|
||||
describe('BucketSpanEstimator', () => {
|
||||
const props = {
|
||||
buttonDisabled: false,
|
||||
estimatorRunning: false,
|
||||
guessBucketSpan: () => {},
|
||||
buttonText: 'Estimate bucket span'
|
||||
};
|
||||
|
||||
const component = (
|
||||
<BucketSpanEstimator {...props} />
|
||||
);
|
||||
|
||||
const wrapper = shallow(component);
|
||||
|
||||
test('renders the button', () => {
|
||||
const props = {
|
||||
buttonDisabled: false,
|
||||
estimatorRunning: false,
|
||||
guessBucketSpan: () => { },
|
||||
buttonText: 'Estimate bucket span'
|
||||
};
|
||||
const wrapper = shallow(<BucketSpanEstimator {...props} />);
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
|
||||
props.buttonDisabled = true;
|
||||
props.estimatorRunning = true;
|
||||
props.buttonText = 'Estimating bucket span';
|
||||
wrapper.setProps(props);
|
||||
|
||||
test('renders the loading button', () => {
|
||||
const props = {
|
||||
buttonDisabled: true,
|
||||
estimatorRunning: true,
|
||||
guessBucketSpan: () => { },
|
||||
buttonText: 'Estimating bucket span'
|
||||
};
|
||||
const wrapper = shallow(<BucketSpanEstimator {...props} />);
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue