MCPcopy
hub / github.com/angular/angular / expectSegment

Function expectSegment

packages/router/test/url_serializer.spec.ts:466–477  ·  view source on GitHub ↗
(
  segment: UrlSegmentGroup,
  expected: string,
  hasChildren: boolean = false,
)

Source from the content-addressed store, hash-verified

464});
465
466function expectSegment(
467 segment: UrlSegmentGroup,
468 expected: string,
469 hasChildren: boolean = false,
470): void {
471 if (segment.segments.filter((s) => s.path === '').length > 0) {
472 throw new Error(`UrlSegments cannot be empty ${segment.segments}`);
473 }
474 const p = segment.segments.map((p) => serializePath(p)).join('/');
475 expect(p).toEqual(expected);
476 expect(Object.keys(segment.children).length > 0).toEqual(hasChildren);
477}

Callers 1

Calls 5

serializePathFunction · 0.90
mapMethod · 0.80
joinMethod · 0.65
keysMethod · 0.65
filterMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…