DEV: add spec for normalize_url_for_output helper function

DEV: add spec for normalize_url_for_output helper function

diff --git a/spec/lib/onebox/helpers_spec.rb b/spec/lib/onebox/helpers_spec.rb
index bcdc343..04efaa6 100644
--- a/spec/lib/onebox/helpers_spec.rb
+++ b/spec/lib/onebox/helpers_spec.rb
@@ -72,6 +72,14 @@ RSpec.describe Onebox::Helpers do
     end
   end
 
+  describe '.normalize_url_for_output' do
+    it { expect(described_class.normalize_url_for_output('http://example.com/fo o')).to eq("http://example.com/fo%20o") }
+    it { expect(described_class.normalize_url_for_output("http://example.com/fo'o")).to eq("http://example.com/fo'o") }
+    it { expect(described_class.normalize_url_for_output('http://example.com/fo"o')).to eq("http://example.com/fo"o") }
+    it { expect(described_class.normalize_url_for_output('http://example.com/fo<o>')).to eq("http://example.com/foo") }
+    it { expect(described_class.normalize_url_for_output('http://example.com/d’écran-à')).to eq("http://example.com/d’écran-à") }
+  end
+
   describe '.uri_encode' do
     it { expect(described_class.uri_encode('http://example.com/f"o&o?[b"ar]')).to eq("http://example.com/f%22o&o?%5Bb%22ar%5D") }
     it { expect(described_class.uri_encode("http://example.com/f.o~o;?<ba'r>")).to eq("http://example.com/f.o~o;?%3Cba%27r%3E") }

GitHub sha: 3568f5b5

1 Like