<commit_before>require_relative '../../app/classes/url_normalizer.rb'
require 'uri'
require 'base64'

describe UrlNormalizer do
  describe ".normalize" do
    def normalized url
      UrlNormalizer.normalize(url)
    end

    it { normalized('http://www.google.com/foo').should == 'http://www.google.com/foo' }
    it { normalized('http://www.google.com/foo#bar').should == 'http://www.google.com/foo' }

    ['utm_source', 'utm_medium', 'utm_source', 'utm_content', 'utm_campaign'].each do |strip_param|
      it "should strip #{strip_param} if it is the only parameter" do
        normalized("http://www.google.com/foo?#{strip_param}=bar").should == 'http://www.google.com/foo'
      end
      it "should strip #{strip_param} if there are other parameters" do
        normalized("http://www.google.com/foo?#{strip_param}=bar&x=y").should == 'http://www.google.com/foo?x=y'
      end
    end

    it { normalized( 'http://www.google.com/?x=y|z').should == 'http://www.google.com/?x=y%7Cz' }
    it { normalized( 'http://www.google.com/?x=y|z').should == 'http://www.google.com/?x=y%7Cz' }
<commit_msg>Revert "Revert "Revert "Revert "Add intentional error to see how that works out""""<commit_after>require_relative '../../app/classes/url_normalizer.rb'
require 'uri'
require 'base64'

describe UrlNormalizer do
  describe ".normalize" do
    def normalized url
      UrlNormalizer.normalize(url)
    end

    it { normalized('http://www.google.com/foo').should == 'httpX://www.google.com/foo' }
    it { normalized('http://www.google.com/foo#bar').should == 'http://www.google.com/foo' }

    ['utm_source', 'utm_medium', 'utm_source', 'utm_content', 'utm_campaign'].each do |strip_param|
      it "should strip #{strip_param} if it is the only parameter" do
        normalized("http://www.google.com/foo?#{strip_param}=bar").should == 'http://www.google.com/foo'
      end
      it "should strip #{strip_param} if there are other parameters" do
        normalized("http://www.google.com/foo?#{strip_param}=bar&x=y").should == 'http://www.google.com/foo?x=y'
      end
    end

    it { normalized( 'http://www.google.com/?x=y|z').should == 'http://www.google.com/?x=y%7Cz' }
    it { normalized( 'http://www.google.com/?x=y|z').should == 'http://www.google.com/?x=y%7Cz' }

{'fraction_non_alphanumeric': 0.19164835164835164, 'fraction_numerical': 0.0035164835164835165, 'mean_word_length': 3.579476861167002, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 24, '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': '1785612', 'n_tokens_mistral': 801, 'n_tokens_neox': 787, 'n_words': 144}