我应该如何为这些查询参数的 if 语句写出单元测试 if 语句?

How should I write out the unit testing if statement for this if statement for these query params?

.ts 文件:

ngOnInit(): void {
    if (
      this.activatedRoute.snapshot.queryParamMap.has('esign') && 
      this.activatedRoute.snapshot.queryParamMap.has('registration')
    ) {
      this.eSignAndRegistration = true;
    }

.spec.ts 文件:

  let esign_registration = false;
  const mockActivatedRoute = {
    snapshot: {
      queryParamMap: {
        has: (response) => {
          if (response == 'esign' && response == 'registration') {
            return esign_registration;
          }

测试:

  fit("should show the 1st mat-card if the param is 'esign&registration'", () => {
    esign_registration = true;
    fixture.detectChanges();
    component.ngOnInit();
    fixture.detectChanges();
    const compiled = fixture.nativeElement;
    expect(component.eSignAndRegistration).toBeTruthy();
  });

错误不断出现,显示为“预期未定义为真。”如何编写 'has' if 语句才能使单元测试正常工作?我试过了

if (response == 'esign' && 'registration')

if (response == 'esign&registration')

以及各种其他方法,但它们都一直给出相同的错误。

response == 'esign' && response == 'registration'

尝试将 && 更改为 ||。如果 response 是一个字符串,它只能是其中之一。