@@ -22,6 +22,7 @@ import {
2222 mockUserMessageWithContent ,
2323 mockWebsocketServerMessage ,
2424 mockWebsocketStatusMessage ,
25+ mockWebsocketStatusMessageWithInteralStage ,
2526} from 'test/helpers/sample/iris-sample-data' ;
2627import { IrisMessage , IrisUserMessage } from 'app/iris/shared/entities/iris-message.model' ;
2728import 'app/shared/util/array.extension' ;
@@ -233,6 +234,18 @@ describe('IrisChatService', () => {
233234 tick ( ) ;
234235 } ) ) ;
235236
237+ it ( 'should handle websocket status message with internal stages' , fakeAsync ( ( ) => {
238+ jest . spyOn ( httpService , 'getCurrentSessionOrCreateIfNotExists' ) . mockReturnValueOnce ( of ( mockServerSessionHttpResponseWithId ( id ) ) ) ;
239+ jest . spyOn ( httpService , 'getChatSessions' ) . mockReturnValue ( of ( [ ] ) ) ;
240+ jest . spyOn ( wsMock , 'subscribeToSession' ) . mockReturnValueOnce ( of ( mockWebsocketStatusMessageWithInteralStage ) ) ;
241+ service . switchTo ( ChatServiceMode . PROGRAMMING_EXERCISE , id ) ;
242+
243+ service . currentStages ( ) . subscribe ( ( stages ) => {
244+ expect ( stages ) . toEqual ( mockWebsocketStatusMessageWithInteralStage . stages . filter ( ( stage ) => ! stage . internal ) ) ;
245+ } ) ;
246+ tick ( ) ;
247+ } ) ) ;
248+
236249 it ( 'should handle websocket message' , fakeAsync ( ( ) => {
237250 jest . spyOn ( httpService , 'getCurrentSessionOrCreateIfNotExists' ) . mockReturnValueOnce ( of ( mockServerSessionHttpResponseWithId ( id ) ) ) ;
238251 jest . spyOn ( httpService , 'getChatSessions' ) . mockReturnValue ( of ( [ ] ) ) ;
0 commit comments