diff --git a/public/pages/CreateMonitor/components/MonitorTimeField/MonitorTimeField.js b/public/pages/CreateMonitor/components/MonitorTimeField/MonitorTimeField.js index ba89267db..d0608a617 100644 --- a/public/pages/CreateMonitor/components/MonitorTimeField/MonitorTimeField.js +++ b/public/pages/CreateMonitor/components/MonitorTimeField/MonitorTimeField.js @@ -11,7 +11,9 @@ import { FormikComboBox } from '../../../../components/FormControls'; const MonitorTimeField = ({ dataTypes }) => { // Default empty option + options from index mappings mapped to ui select form - const dateFields = Array.from(dataTypes.date || []); + const dateFields = Array.from(dataTypes.date || []).concat( + Array.from(dataTypes.date_nanos || []) + ); const options = [].concat(dateFields).map((option) => ({ label: option })); return ( { expect(render(component)).toMatchSnapshot(); }); - test.skip('displays no options', () => { + test('displays no options', () => { const wrapper = mount( {}}> ); // Default blank option - expect(wrapper.find('select').props().children[1].length).toBe(1); + expect(wrapper.find('EuiComboBox').props().options.length).toBe(0); }); - test.skip('displays options', () => { + test('displays options', () => { const wrapper = mount( {}}> ); - // 3 options + default blank option - expect(wrapper.find('select').props().children[1].length).toBe(4); + // 3 options + expect(wrapper.find('EuiComboBox').props().options.length).toBe(3); + }); + + test('displays options includes date_nanos', () => { + const wrapper = mount( + {}}> + + + ); + expect(wrapper).toMatchSnapshot(); + + // 4 options + expect(wrapper.find('EuiComboBox').props().options.length).toBe(4); + expect(wrapper.find('EuiComboBox').props().options).toEqual( + expect.arrayContaining([{ label: 'date_nanos1' }]) + ); }); });