@@ -23,7 +23,7 @@ import {MatDialog, MatDialogModule} from '@angular/material/dialog';
2323import { MatSnackBar } from '@angular/material/snack-bar' ;
2424import { By } from '@angular/platform-browser' ;
2525import { NoopAnimationsModule } from '@angular/platform-browser/animations' ;
26- import { ActivatedRoute , NavigationEnd , Router , UrlTree } from '@angular/router' ;
26+ import { ActivatedRoute , NavigationEnd , Params , Router , UrlTree } from '@angular/router' ;
2727// 1p-ONLY-IMPORTS: import {beforeEach, describe, expect, it}
2828import { BehaviorSubject , NEVER , of , ReplaySubject , Subject , throwError } from 'rxjs' ;
2929
@@ -190,11 +190,12 @@ describe('ChatComponent', () => {
190190 mockAgentBuilderService = jasmine . createSpyObj (
191191 'AgentBuilderService' , [ 'clear' , 'setLoadedAgentData' ] ) ;
192192
193+ const queryParamsSubject = new BehaviorSubject < Params > ( { } ) ;
193194 mockActivatedRoute = {
194195 snapshot : {
195196 queryParams : { } ,
196197 } as any ,
197- queryParams : of ( { } ) ,
198+ queryParams : queryParamsSubject ,
198199 } ;
199200
200201 const appName = new BehaviorSubject < string > ( TEST_APP_1_NAME ) ;
@@ -320,9 +321,9 @@ describe('ChatComponent', () => {
320321 mockAgentService . listAppsResponse . next (
321322 [ TEST_APP_1_NAME , TEST_APP_2_NAME ] ) ;
322323
323- mockActivatedRoute . snapshot ! . queryParams = {
324- [ APP_QUERY_PARAM ] : INVALID_APP_NAME ,
325- } ;
324+ const params = { [ APP_QUERY_PARAM ] : INVALID_APP_NAME } ;
325+ mockActivatedRoute . snapshot ! . queryParams = params ;
326+ ( mockActivatedRoute . queryParams as Subject < Params > ) . next ( params ) ;
326327 mockAgentService . listAppsResponse . next ( [ TEST_APP_1_NAME ] ) ;
327328 fixture = TestBed . createComponent ( ChatComponent ) ;
328329 component = fixture . componentInstance ;
@@ -401,9 +402,11 @@ describe('ChatComponent', () => {
401402 mockAgentService . listAppsResponse . next (
402403 [ TEST_APP_1_NAME , TEST_APP_2_NAME ] ) ;
403404
404- mockActivatedRoute . snapshot ! . queryParams = {
405+ const params = {
405406 [ APP_QUERY_PARAM ] : TEST_APP_2_NAME ,
406407 } ;
408+ mockActivatedRoute . snapshot ! . queryParams = params ;
409+ ( mockActivatedRoute . queryParams as Subject < Params > ) . next ( params ) ;
407410 component . ngOnInit ( ) ;
408411 } ) ;
409412 it ( 'should create new session on init' , ( ) => {
@@ -420,10 +423,12 @@ describe('ChatComponent', () => {
420423 beforeEach ( ( ) => {
421424 mockAgentService . listAppsResponse . next ( [ TEST_APP_1_NAME ] ) ;
422425 mockFeatureFlagService . isSessionUrlEnabledResponse . next ( true ) ;
423- mockActivatedRoute . snapshot ! . queryParams = {
426+ const params = {
424427 [ APP_QUERY_PARAM ] : TEST_APP_1_NAME ,
425428 [ SESSION_QUERY_PARAM ] : SESSION_2_ID ,
426429 } ;
430+ mockActivatedRoute . snapshot ! . queryParams = params ;
431+ ( mockActivatedRoute . queryParams as Subject < Params > ) . next ( params ) ;
427432 mockSessionService . getSessionResponse . next (
428433 { id : SESSION_2_ID , state : { } , events : [ ] } ) ;
429434 } ) ;
@@ -471,10 +476,12 @@ describe('ChatComponent', () => {
471476
472477 describe ( 'when session in URL is not found' , ( ) => {
473478 beforeEach ( async ( ) => {
474- mockActivatedRoute . snapshot ! . queryParams = {
479+ const params = {
475480 [ APP_QUERY_PARAM ] : TEST_APP_1_NAME ,
476481 [ SESSION_QUERY_PARAM ] : SESSION_2_ID ,
477482 } ;
483+ mockActivatedRoute . snapshot ! . queryParams = params ;
484+ ( mockActivatedRoute . queryParams as Subject < Params > ) . next ( params ) ;
478485 mockSessionService . getSession . and . callFake (
479486 ( userId : string , app : string , sessionId : string ) => {
480487 if ( sessionId === SESSION_2_ID ) {
0 commit comments