test/devcenter-parser_test.rb in devcenter-parser-2.2.5 vs test/devcenter-parser_test.rb in devcenter-parser-2.2.6
- old
+ new
@@ -334,12 +334,20 @@
HTML
assert_parsing_result md, html
end
it 'converts relative links with missing initial slashes to article links' do
- ['foo', 'foo/bar', 'foo#bar', '123'].each do |href|
+ ['foo', 'foo/bar', 'foo#bar', '123', 'categories'].each do |href|
md = "[link](#{href})"
html = "<p><a href=\"/articles/#{href}\">link</a></p>"
+ assert_parsing_result md, html
+ end
+ end
+
+ it 'ignores links with missing initial slashes IFF they start with `categories/`' do
+ ['categories/foo', 'categories/foo/bar', 'categories/foo#bar', 'categories/123'].each do |href|
+ md = "[link](#{href})"
+ html = "<p><a href=\"/#{href}\">link</a></p>"
assert_parsing_result md, html
end
end
it 'converts "articles/foo relative links with missing initial slashes to article links' do