<commit_before>'use strict';

describe('StreamdataEventSource.', function () {

  describe('CheckDecorateDecoratesURLs', function() {

      beforeEach(function() {
          delete streamdataio.Pk;
          delete streamdataio.pk;
      });

    it('should decorate a simple url with no params', function () {
      //GIVEN
      var e = new StreamdataEventSource("http://www.google.fr", "ZWZiNzlhYTItYjA5MC00YWMwLWE2NTQtYmNmZmJiNDkyZGYz");
      var expectedConvertedUrl = "https://streamdata.motwin.net/http://www.google.fr/?X-Sd-Token=<KEY>";
      var convertedUrl = e._decorate(e._url);

      expect(expectedConvertedUrl).toEqual(convertedUrl);
    });

    it('should decorate a url with params', function () {
      //GIVEN
      var e = new StreamdataEventSource("http://www.google.fr?toto=1",  "ZWZiNzlhYTItYjA5MC00YWMwLWE2NTQtYmNmZmJiNDkyZGYz");
      var expectedConvertedUrl = "https://streamdata.motwin.net/http://www.google.fr/?toto=1&X-Sd-Token=<KEY>";

      var convertedUrl = e._decorate(e._url);

      expect(expectedConvertedUrl).toEqual(convertedUrl);
    });

    it('should decorate a url with userinfo', function () {
      //GIVEN
      var e = new StreamdataEventSource("http://john:doe@www.google.fr?toto=1",  "ZWZiNzlhYTItYjA5MC00YWMwLWE2NTQtYmNmZmJiNDkyZGYz");
      var expectedConvertedUrl = "https://streamdata.motwin.net/http://john:doe@www.google.fr/?toto=1&X-Sd-Token=<KEY>NTQtYmNmZmJiNDkyZGYz";

      var convertedUrl = e._decorate(e._url);

      expect(expectedConvertedUrl).toEqual(convertedUrl);
    });

    it('should decorate a url with userinfo and query param with @', function () {
      //GIVEN
      var e = new StreamdataEventSource("http://john:doe@www.faroo.com/api?q=knicks&start=1&length=10&l=en&src=news&f=json&key=gbnEDrs@SAjQd6OVhqY_",  "ZWZiNzlhYTItYjA5MC00YWMwLWE2NTQtYmNmZmJiNDkyZGYz");
      var expectedConvertedUrl = "https://streamdata.motwin.net/http://john:doe@www.faroo.com/api?q=knicks&start=1&length=10&l=en&src=news&f=json&key=gbnEDrs@SAjQd6OVhqY_&X-Sd-Token=<KEY>";

      var convertedUrl = e._decorate(e._url);

      expect(expectedConvertedUrl).toEqual(convertedUrl);
    });

    it('should decorate a url with params that contains an @', function () {
      //GIVEN
      var e = new StreamdataEventSource("http://www.faroo.com/api?q=knicks&start=1&length=10&l=en&src=news&f=json&key=gbnEDrs@SAjQd6OVhqY_",  "ZWZiNzlhYTItYjA5MC00YWMwLWE2NTQtYmNmZmJiNDkyZGYz");
      var expectedConvertedUrl = "https://streamdata.motwin.net/http://www.faroo.com/api?q=knicks&start=1&length=10&l=en&src=news&f=json&key=gbnEDrs@SAjQd6OVhqY_&X-Sd-Token=ZWZiNzlhYTItYjA5MC00YWMwLWE2NTQtYmNmZmJiNDkyZGYz";

      var convertedUrl = e._decorate(e._url);

      expect(expectedConvertedUrl).toEqual(convertedUrl);
    });

  });<commit_msg>Bug #16611 : remove token from unit tests<commit_after>'use strict';

describe('StreamdataEventSource.', function () {

  describe('CheckDecorateDecoratesURLs', function() {

      beforeEach(function() {
          delete streamdataio.Pk;
          delete streamdataio.pk;
      });

    it('should decorate a simple url with no params', function () {
      //GIVEN
      var e = new StreamdataEventSource("http://www.google.fr", "someRandomExtraLongDummyToken");
      var expectedConvertedUrl = "https://streamdata.motwin.net/http://www.google.fr/?X-Sd-Token=someRandomExtraLongDummyToken";
      var convertedUrl = e._decorate(e._url);

      expect(expectedConvertedUrl).toEqual(convertedUrl);
    });

    it('should decorate a url with params', function () {
      //GIVEN
      var e = new StreamdataEventSource("http://www.google.fr?toto=1",  "someRandomExtraLongDummyToken");
      var expectedConvertedUrl = "https://streamdata.motwin.net/http://www.google.fr/?toto=1&X-Sd-Token=someRandomExtraLongDummyToken";

      var convertedUrl = e._decorate(e._url);

      expect(expectedConvertedUrl).toEqual(convertedUrl);
    });

    it('should decorate a url with userinfo', function () {
      //GIVEN
      var e = new StreamdataEventSource("http://john:doe@www.google.fr?toto=1",  "someRandomExtraLongDummyToken");
      var expectedConvertedUrl = "https://streamdata.motwin.net/http://john:doe@www.google.fr/?toto=1&X-Sd-Token=someRandomExtraLongDummyToken";

      var convertedUrl = e._decorate(e._url);

      expect(expectedConvertedUrl).toEqual(convertedUrl);
    });

    it('should decorate a url with userinfo and query param with @', function () {
      //GIVEN
      var e = new StreamdataEventSource("http://john:doe@www.faroo.com/api?q=knicks&start=1&length=10&l=en&src=news&f=json&key=gbnEDrs@SAjQd6OVhqY_",  "someRandomExtraLongDummyToken");
      var expectedConvertedUrl = "https://streamdata.motwin.net/http://john:doe@www.faroo.com/api?q=knicks&start=1&length=10&l=en&src=news&f=json&key=gbnEDrs@SAjQd6OVhqY_&X-Sd-Token=someRandomExtraLongDummyToken";

      var convertedUrl = e._decorate(e._url);

      expect(expectedConvertedUrl).toEqual(convertedUrl);
    });

    it('should decorate a url with params that contains an @', function () {
      //GIVEN
      var e = new StreamdataEventSource("http://www.faroo.com/api?q=knicks&start=1&length=10&l=en&src=news&f=json&key=gbnEDrs@SAjQd6OVhqY_",  "someRandomExtraLongDummyToken");
      var expectedConvertedUrl = "https://streamdata.motwin.net/http://www.faroo.com/api?q=knicks&start=1&length=10&l=en&src=news&f=json&key=gbnEDrs@SAjQd6OVhqY_&X-Sd-Token=someRandomExtraLongDummyToken";

      var convertedUrl = e._decorate(e._url);

      expect(expectedConvertedUrl).toEqual(convertedUrl);
    });

  });
{'fraction_non_alphanumeric': 0.14679556032939492, 'fraction_numerical': 0.012352309344790547, 'mean_word_length': 4.3824662813102115, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 10, 'lorem ipsum': 0, 'www.': 20, 'xml': 0}, 'pii_count': 8, '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': '1352974', 'n_tokens_mistral': 2143, 'n_tokens_neox': 2067, 'n_words': 246}