title: Testing Angular queryParams with Jasmine
body: <p><a href="https://stackblitz.com/edit/angular-queryparam-we1uj2?file=src/app/search/search.component.ts" rel="nofollow noreferrer">StackBlitz example</a></p>
  <p>I want to be able to test the param being passed from one view to the other. I want to test to see if the param is there and that the param matches the mock test data I give it.</p>
  <p>I'm quite new to unit tests, done a lot of reading into setting up the test in respect to the activated route and passing a param. I think the bit I am stuck on is the &quot;expect&quot;. Its giving me an error</p>
  <pre><code>Argument of type '{ urn: string[]; }' is not assignable to parameter of type 'Expected&lt;Observable&lt;Params&gt;&gt;'
  </code></pre>
  <p><strong>component</strong></p>
  <pre><code> export class SearchComponent implements OnInit {
    constructor(private route: ActivatedRoute, private router: Router) {
      this.getParam();
    }
  
    ngOnInit() {
    }
  
    getParam():void {
      this.route.queryParams.subscribe(params =&gt; {
        console.log(params[&quot;urn&quot;]);
      });
  }
  }
  </code></pre>
  <p><strong>spec</strong></p>
  <pre><code>providers: [
          HttpClient,
          {
            provide: ActivatedRoute,
            useValue: {
              queryParams: of({
                urn: '123'
              })
            }
          }
        ],
  ...
  
    it('test queryParam in route', () =&gt; {
      const activatedRoute: ActivatedRoute = fixture.debugElement.injector.get(ActivatedRoute);
  
      activatedRoute.queryParams = of({ urn: '123' });
  
      fixture.detectChanges(); 
      //  tick();
  
      expect(activatedRoute.queryParams).toEqual({ urn: ['123'] }); // this line giving me trouble
    });
  </code></pre>
  <p>If anybody can give me a hand to see what I am doing wrong - here is the <a href="https://stackblitz.com/edit/angular-queryparam-we1uj2?file=src/app/search/search.component.spec.ts" rel="nofollow noreferrer">stackBlitz I came up with to demo</a></p>