MCPcopy Create free account
hub / github.com/TestSprite/testsprite-cli / uniqueNonNull

Function uniqueNonNull

src/commands/test.ts:8302–8307  ·  view source on GitHub ↗

* If every non-null entry shares the same value, return it; otherwise * undefined. Used by step rendering to surface a per-response shared * `runId` / `codeVersion` once instead of in every row.

(values: Array<string | null>)

Source from the content-addressed store, hash-verified

8300 * `runId` / `codeVersion` once instead of in every row.
8301 */
8302function uniqueNonNull(values: Array<string | null>): string | undefined {
8303 const filtered = values.filter((v): v is string => v !== null);
8304 if (filtered.length === 0) return undefined;
8305 const first = filtered[0]!;
8306 return filtered.every(v => v === first) ? first : undefined;
8307}
8308
8309function pad(s: string, width: number): string {
8310 if (s.length >= width) return s;

Callers 1

renderStepsTextFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected