import { ReactWrapper } from 'enzyme' ; type Matcher = '=' | '~=' | '|=' | '^=' | '$=' | '*=' ; const MATCHERS = [ '=' , '~=' , '|=' , '^=' , '$=' , '*=' , ] ; param reactWrapper param testSubjectSelector param matcher export const findTestSubject = < T = string > ( reactWrapper , testSubjectSelector , matcher = '~=' ) => { if ( ! MATCHERS . includes ( matcher ) ) { throw new Error ( 'Matcher ' . concat ( matcher , ' not found in list of allowed matchers: ' ) . concat ( MATCHERS . join ( ' ' ) ) ) ; } const testSubject = reactWrapper . find ( `[data-test-subj${ matcher }"${ testSubjectSelector }"]` ) ; return testSubject . hostNodes ( ) ; } ;