How to mock Stomp over WebSocket with Jasmine on Angular

I have a connection with Stomp over a WebSocket, it looks like

var authenticity_token = {authenticity_token: $cookies.get('XSRF-TOKEN')};
  var ws = new WebSocket(GlobalSettings.STOMP_URL);
  var stomp = Stomp.over(ws);

  $scope.allRequests = [];
  stomp.connect( {}, authenticity_token, function(){
    $scope.allRequests.forEach(function(requestId){
      stomp.subscribe('/stomplets/eventable/update/request/id=' + requestId, function(message){
        $scope.liveUpdateState(JSON.parse(message.body));
      });
    });
  });

But I have no idea how to test. Please help me.

+4
source share

Source: https://habr.com/ru/post/1660819/


All Articles