import { APIClient } from '../APIClient' ; import { StatusCode } from '../http' ; describe ( '"AssetAPI"' , ( ) => { const apiClient = new APIClient ( ) ; it ( 'adds token parameters' , async ( ) => { spyOn ( apiClient . transport . http , 'sendRequest' ) . and . returnValue ( Promise . resolve ( { config : { } , data : '' , headers : { } , status : StatusCode . OK , statusText : 'OK' , } ) ) ; const assetId = 'my-asset-id' ; const assetToken = 'my-asset-token' ; await apiClient . asset . api . getAssetV3 ( assetId , assetToken ) ; expect ( apiClient . transport . http . sendRequest ) . toHaveBeenCalledWith ( jasmine . objectContaining ( { params : { asset_token : assetToken , } , url : jasmine . stringMatching ( new RegExp ( assetId ) ) , } ) , true ) ; } ) ; it ( 'removes token parameters' , async ( ) => { spyOn ( apiClient . transport . http , 'sendRequest' ) . and . returnValue ( Promise . resolve ( { config : { } , data : '' , headers : { } , status : StatusCode . OK , statusText : 'OK' , } ) ) ; const assetId = 'my-asset-id' ; await apiClient . asset . api . getAssetV3 ( assetId ) ; expect ( apiClient . transport . http . sendRequest ) . toHaveBeenCalledWith ( jasmine . objectContaining ( { params : { } , url : jasmine . stringMatching ( new RegExp ( assetId ) ) , } ) , true ) ; } ) ; } ) ;