如果我在下面有这个模拟激活路由,我可以在类型为“不匹配”时编写一些测试,但如果我想编写一些类型为“管理员不匹配”的测试。如何更改查询参数的值?
await TestBed.configureTestingModule({
declarations: [ErrorPageComponent],
imports: [GraphQLModule, RouterTestingModule],
providers: [
Apollo,
{
provide: ActivatedRoute,
useValue: {
queryParams: of({
name: 'John Doe',
cacheKey: 'cacheKey',
type: 'mismatch'
})
}
},
]
}).compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(ErrorPageComponent);
component = fixture.componentInstance;
route = TestBed.inject(ActivatedRoute);
fixture.detectChanges();
});