<commit_before>module("Stomp Message");

test("Send and receive a message", function() {
  
  var client = Stomp.client(TEST.url);
  client.debug = TEST.debug;
  client.connect(TEST.login, TEST.password,
    function() {
      client.subscribe(TEST.destination, function(message)
      {
        start();
        equals(message.body, "message body");
        client.disconnect();
      });
      
      client.send(TEST.destination, {}, "message body");
    });
    stop(TEST.timeout);
});<commit_msg>test: message with JSON stringified body<commit_after>module("Stomp Message");

test("Send and receive a message", function() {
  
  var client = Stomp.client(TEST.url);
  client.debug = TEST.debug;
  client.connect(TEST.login, TEST.password,
    function() {
      client.subscribe(TEST.destination, function(message)
      {
        start();
        equals(message.body, "message body");
        client.disconnect();
      });
      
      client.send(TEST.destination, {}, "message body");
    });
    stop(TEST.timeout);
});

test("Send and receive a message with a JSON body", function() {
  
  var client = Stomp.client(TEST.url);
  var payload = {text: "hello", bool: true, value: 1.234};
  
  client.connect(TEST.login, TEST.password,
    function() {
      client.subscribe(TEST.destination, function(message)
      {
        start();
        var res = JSON.parse(message.body);
        equals(res.text, payload.text);
        equals(res.bool, payload.bool);
        equals(res.value, payload.value);
        client.disconnect();
      });
      
      client.send(TEST.destination, {}, JSON.stringify(payload));
    });
    stop(TEST.timeout);
});
{'fraction_non_alphanumeric': 0.15440289505428226, 'fraction_numerical': 0.0024125452352231603, 'mean_word_length': 2.831408775981524, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6397632', 'n_tokens_mistral': 488, 'n_tokens_neox': 484, 'n_words': 99}