import { exampleResult } from '../../../../__mocks__/content_sources.mock' ; import React from 'react' ; import { shallow } from 'enzyme' ; import { SubtitleField } from './subtitle_field' ; describe ( 'SubtitleField' , ( ) => { const result = { ... exampleResult . exampleDocuments [ 0 ] , foo : 'bar' , } ; it ( 'renders' , ( ) => { const props = { result , subtitleField : 'foo' , subtitleFieldHover : false , } ; const wrapper = shallow ( < SubtitleField { ... props } / > ) ; expect ( wrapper . find ( '[data-test-subj="SubtitleField"]' ) ) . toHaveLength ( 1 ) ; } ) ; it ( 'shows fallback URL label when no override set' , ( ) => { const props = { result , subtitleField : null , subtitleFieldHover : false , } ; const wrapper = shallow ( < SubtitleField { ... props } / > ) ; expect ( wrapper . find ( '[data-test-subj="DefaultSubtitleLabel"]' ) ) . toHaveLength ( 1 ) ; } ) ; } ) ;