MCPcopy Create free account
hub / github.com/angular/components / _assertResultFound

Function _assertResultFound

src/cdk/testing/harness-environment.ts:494–506  ·  view source on GitHub ↗

Verifies that there is at least one result in an array.

(
  results: Promise<T[]>,
  queryDescriptions: string[],
)

Source from the content-addressed store, hash-verified

492
493/** Verifies that there is at least one result in an array. */
494async function _assertResultFound<T>(
495 results: Promise<T[]>,
496 queryDescriptions: string[],
497): Promise<T> {
498 const result = (await results)[0];
499 if (result == undefined) {
500 throw Error(
501 `Failed to find element matching one of the following queries:\n` +
502 queryDescriptions.map(desc => `(${desc})`).join(',\n'),
503 );
504 }
505 return result;
506}
507
508/** Gets a list of description strings from a list of queries. */
509function _getDescriptionForLocatorForQueries(queries: (string | HarnessQuery<any>)[]) {

Callers 3

locatorForFunction · 0.85
harnessLoaderForFunction · 0.85
getChildLoaderFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected