import React from 'react' ; import { mount } from 'enzyme' ; import { EuiThemeProvider } from '../../../../../../../src/plugins/kibana_react/common' ; import { BuilderAndBadgeComponent } from './and_badge' ; describe ( 'BuilderAndBadgeComponent' , ( ) => { test ( 'it renders exceptionItemEntryFirstRowAndBadge for very first exception item in builder' , ( ) => { const wrapper = mount ( < EuiThemeProvider > < BuilderAndBadgeComponent entriesLength = { 2 } exceptionItemIndex = { 0 } / > < /EuiThemeProvider>); expect ( wrapper . find ( '[data-test-subj="exceptionItemEntryFirstRowAndBadge"]' ) . exists ( ) ) . toBeTruthy ( ) ; } ) ; test ( 'it renders exceptionItemEntryInvisibleAndBadge if "entriesLength" is 1 or less' , ( ) => { const wrapper = mount ( < EuiThemeProvider > < BuilderAndBadgeComponent entriesLength = { 1 } exceptionItemIndex = { 0 } / > < /EuiThemeProvider>); expect ( wrapper . find ( '[data-test-subj="exceptionItemEntryInvisibleAndBadge"]' ) . exists ( ) ) . toBeTruthy ( ) ; } ) ; test ( 'it renders regular "and" badge if exception item is not the first one and includes more than one entry' , ( ) => { const wrapper = mount ( < EuiThemeProvider > < BuilderAndBadgeComponent entriesLength = { 2 } exceptionItemIndex = { 1 } / > < /EuiThemeProvider>); expect ( wrapper . find ( '[data-test-subj="exceptionItemEntryAndBadge"]' ) . exists ( ) ) . toBeTruthy ( ) ; } ) ; } ) ;