import { HttpClient } from '../http' ; import { ConversationAPI } from './ConversationAPI' ; const httpClientMock = jasmine . createSpyObj ( 'httpClient' , { sendJSON : ( ) => ( { data : '' } ) } ) ; describe ( 'ConversationAPI' , ( ) => { const conversationApi = new ConversationAPI ( httpClientMock as HttpClient ) ; describe ( 'postORTMessage' , ( ) => { it ( 'add ignore_missing and report_missing parameters' , async ( ) => { await conversationApi . postOTRMessage ( 'client-id' , 'conv-id' , undefined , false ) ; expect ( httpClientMock . sendJSON ) . toHaveBeenCalledWith ( jasmine . objectContaining ( { params : { ignore_missing : false } , } ) , true ) ; await conversationApi . postOTRMessage ( 'client-id' , 'conv-id' , undefined , true ) ; expect ( httpClientMock . sendJSON ) . toHaveBeenCalledWith ( jasmine . objectContaining ( { params : { ignore_missing : true } } ) , true ) ; await conversationApi . postOTRMessage ( 'client-id' , 'conv-id' , undefined , [ 'user1' , 'user2' ] ) ; expect ( httpClientMock . sendJSON ) . toHaveBeenCalledWith ( jasmine . objectContaining ( { params : { ignore_missing : 'user1,user2' } , } ) , true ) ; } ) ; } ) ; } ) ;