MCPcopy
hub / github.com/angular/angular / expectPageIndex

Function expectPageIndex

packages/router/test/computed_state_restoration.spec.ts:22–32  ·  view source on GitHub ↗
(index: number)

Source from the content-addressed store, hash-verified

20
21for (const browserAPI of ['navigation', 'history'] as const) {
22 const expectPageIndex = (index: number) => {
23 if (browserAPI === 'navigation') {
24 const navigation = TestBed.inject(PlatformNavigation);
25 const entries = navigation.entries();
26 expect(entries.indexOf(navigation.currentEntry!)).toBe(index);
27 } else {
28 expect(TestBed.inject(Location).getState()).toEqual(
29 jasmine.objectContaining({ɵrouterPageId: index}),
30 );
31 }
32 };
33
34 describe(`canceledNavigationResolution: 'computed' with ${browserAPI}-based routing`, () => {
35 useAutoTick();

Calls 4

indexOfMethod · 0.80
injectMethod · 0.65
entriesMethod · 0.45
getStateMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…