import { ReactTestInstance } from "react-test-renderer" ; import matchText , { TextMatchOptions , TextMatchPattern } from "./matchText" ; const matcher = ( pattern , options ? ) => ( i ) => { if ( typeof i . type !== "string" || ! i . props . id ) { return false ; } return matchText ( pattern , i . props . id , { collapseWhitespace : false , ... options , } ) ; } ; export function getByID ( container , pattern , options ? ) { return container . find ( matcher ( pattern , options ) ) ; } export function queryByID ( container , pattern , options ? ) { const results = container . findAll ( matcher ( pattern , options ) ) ; if ( ! results . length ) { return null ; } return results [ 0 ] ; }