Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
set testParamMap(params: {}) {
this._testParamMap = convertToParamMap(params);
this.subject.next(this._testParamMap);
}
get snapshot() {
return {
params: this.testParams,
queryParamMap: convertToParamMap(this.testParams)
}
}
}
setParamMap(params?: Params): void {
this.paramMapSubject.next(convertToParamMap(params || {}));
}
it('should call OcLineItems.ListAll with order id param', () => {
component.getLineItems().subscribe(() => {
expect(appLineItemService.listAll).toHaveBeenCalledWith(mockOrderID);
});
paramMap.next(convertToParamMap({ orderID: mockOrderID }));
});
});
set testParamMap(params: {}) {
this._testParamMap = convertToParamMap(params);
this.subject.next(this._testParamMap);
}
function generateActivatedRouteSnapshot(userId?: string): ActivatedRouteSnapshot {
return {paramMap: convertToParamMap({userId})} as ActivatedRouteSnapshot;
}
{
path: 'project/:projectId/build/:buildId',
component: DummyComponent
},
{
path: '404',
component: DummyComponent
}
])
],
declarations: [ProjectComponent, DummyComponent],
providers: [
{provide: DataService, useValue: dataService}, {
provide: ActivatedRoute,
useValue:
{paramMap: Observable.of(convertToParamMap({id: '123'}))}
},
{provide: MatDialog, useValue: dialog}
],
})
.compileComponents();
fixture = TestBed.createComponent(ProjectComponent);
fixtureEl = fixture.debugElement;
component = fixture.componentInstance;
location = TestBed.get(Location);
}));
function createRoute(queryParams: {[key: string]: string}): ActivatedRoute {
return {
snapshot: {
data: {
users: [ { id: 1, login: 'jb' }, { id: 2, login: 'ced' } ]
},
queryParamMap: convertToParamMap(queryParams)
}
} as any;
}
root?: ActivatedRouteSnapshot;
/** The parent of this route in the router state tree */
parent?: ActivatedRouteSnapshot | null;
/** The first child of this route in the router state tree */
firstChild?: ActivatedRouteSnapshot | null;
/** The children of this route in the router state tree */
children?: ActivatedRouteSnapshot[];
/** The path from the root of the router state tree to this route */
pathFromRoot?: ActivatedRouteSnapshot[];
}): ActivatedRouteSnapshot {
return {
url: options.url,
params: options.params,
paramMap: options.params && convertToParamMap(options.params),
queryParams: options.queryParams,
queryParamMap: options.queryParams && convertToParamMap(options.queryParams),
fragment: options.fragment,
data: options.data,
outlet: options.outlet,
component: options.component,
routeConfig: options.routeConfig,
root: options.root,
parent: options.parent,
firstChild: options.firstChild,
children: options.children,
pathFromRoot: options.pathFromRoot
} as ActivatedRouteSnapshot;
}
routeConfig?: Route;
/** The root of the router state */
root?: ActivatedRouteSnapshot;
/** The parent of this route in the router state tree */
parent?: ActivatedRouteSnapshot | null;
/** The first child of this route in the router state tree */
firstChild?: ActivatedRouteSnapshot | null;
/** The children of this route in the router state tree */
children?: ActivatedRouteSnapshot[];
/** The path from the root of the router state tree to this route */
pathFromRoot?: ActivatedRouteSnapshot[];
}): ActivatedRouteSnapshot {
return {
url: options.url,
params: options.params,
paramMap: options.params && convertToParamMap(options.params),
queryParams: options.queryParams,
queryParamMap: options.queryParams && convertToParamMap(options.queryParams),
fragment: options.fragment,
data: options.data,
outlet: options.outlet,
component: options.component,
routeConfig: options.routeConfig,
root: options.root,
parent: options.parent,
firstChild: options.firstChild,
children: options.children,
pathFromRoot: options.pathFromRoot
} as ActivatedRouteSnapshot;
}