(instance: TestInstance, { printElementTree = true } = {})
| 131 | } |
| 132 | |
| 133 | function queryByQuery(instance: TestInstance, { printElementTree = true } = {}) { |
| 134 | return function singleQueryFn(predicate: Predicate, options?: Options) { |
| 135 | const results = queryAllByQuery(instance)(predicate, options); |
| 136 | |
| 137 | if (results.length > 1) { |
| 138 | throw new ErrorWithStack( |
| 139 | formatErrorMessage(getMultipleError(predicate, options), printElementTree), |
| 140 | singleQueryFn, |
| 141 | ); |
| 142 | } |
| 143 | |
| 144 | if (results.length === 0) { |
| 145 | return null; |
| 146 | } |
| 147 | |
| 148 | return results[0]; |
| 149 | }; |
| 150 | } |
| 151 | |
| 152 | function getByQuery(instance: TestInstance, { printElementTree = true } = {}) { |
| 153 | return function getFn(predicate: Predicate, options?: Options) { |
nothing calls this directly
no test coverage detected
searching dependent graphs…