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

Function expectSegment

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

Source from the content-addressed store, hash-verified

630});
631
632function expectSegment(
633 segment: UrlSegmentGroup,
634 expected: string,
635 hasChildren: boolean = false,
636): void {
637 if (segment.segments.filter((s) => s.path === '').length > 0) {
638 throw new Error(`UrlSegments cannot be empty ${segment.segments}`);
639 }
640 const p = segment.segments.map((p) => serializePath(p)).join('/');
641 expect(p).toEqual(expected);
642 expect(Object.keys(segment.children).length > 0).toEqual(hasChildren);
643}

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