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

Function expectSegment

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

Source from the content-addressed store, hash-verified

505});
506
507function expectSegment(
508 segment: UrlSegmentGroup,
509 expected: string,
510 hasChildren: boolean = false,
511): void {
512 if (segment.segments.filter((s) => s.path === '').length > 0) {
513 throw new Error(`UrlSegments cannot be empty ${segment.segments}`);
514 }
515 const p = segment.segments.map((p) => serializePath(p)).join('/');
516 expect(p).toEqual(expected);
517 expect(Object.keys(segment.children).length > 0).toEqual(hasChildren);
518}

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