MCPcopy Create free account
hub / github.com/angular/angular / expectSegment

Function expectSegment

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

Source from the content-addressed store, hash-verified

475});
476
477function expectSegment(
478 segment: UrlSegmentGroup,
479 expected: string,
480 hasChildren: boolean = false,
481): void {
482 if (segment.segments.filter((s) => s.path === '').length > 0) {
483 throw new Error(`UrlSegments cannot be empty ${segment.segments}`);
484 }
485 const p = segment.segments.map((p) => serializePath(p)).join('/');
486 expect(p).toEqual(expected);
487 expect(Object.keys(segment.children).length > 0).toEqual(hasChildren);
488}

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