import React from 'react' ; import { ServiceField , TransactionTypeField } from './fields' ; import { render } from '@testing-library/react' ; import { expectTextsInDocument } from '../../utils/testHelpers' ; describe ( 'alerting fields' , ( ) => { describe ( 'Service Field' , ( ) => { it ( 'renders with value' , ( ) => { const component = render ( < ServiceField currentValue = "foo" onChange = { ( ) => { } } />); expectTextsInDocument ( component , [ 'foo' ] ) ; } ) ; it ( 'renders with All when value is not defined' , ( ) => { const component = render ( < ServiceField onChange = { ( ) => { } } />); expectTextsInDocument ( component , [ 'All' ] ) ; } ) ; } ) ; describe ( 'TransactionTypeField' , ( ) => { it ( 'renders' , ( ) => { const component = render ( < TransactionTypeField currentValue = "Bar" onChange = { ( ) => { } } />); expectTextsInDocument ( component , [ 'Bar' ] ) ; } ) ; it ( 'renders current value when available' , ( ) => { const component = render ( < TransactionTypeField currentValue = "foo" onChange = { ( ) => { } } />); expectTextsInDocument ( component , [ 'foo' ] ) ; } ) ; } ) ; } ) ;