* Searches for an instance of the component corresponding to the given harness type and index * under the `HarnessEnvironment`'s root element, and returns a `ComponentHarness` for that * instance. The index specifies the offset of the component to find. If no matching * component is found a
(
query: HarnessQuery<T>,
offset: number,
)
| 259 | * @throws If a matching component instance can't be found. |
| 260 | */ |
| 261 | async getHarnessAtIndex<T extends ComponentHarness>( |
| 262 | query: HarnessQuery<T>, |
| 263 | offset: number, |
| 264 | ): Promise<T> { |
| 265 | if (offset < 0) { |
| 266 | throw Error('Index must not be negative'); |
| 267 | } |
| 268 | const harnesses = await this.locatorForAll(query)(); |
| 269 | if (offset >= harnesses.length) { |
| 270 | throw Error(`No harness was located at index ${offset}`); |
| 271 | } |
| 272 | return harnesses[offset]; |
| 273 | } |
| 274 | |
| 275 | /** |
| 276 | * Searches for all instances of the component corresponding to the given harness type under the |
nothing calls this directly
no test coverage detected