X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/e9fa0055a50664976c6d976ccdaa7de7ae261b56..c53db246f606e0233a524e8f3c6390ea74e96890:/test/helpers/browse_helper_test.rb diff --git a/test/helpers/browse_helper_test.rb b/test/helpers/browse_helper_test.rb index 6ca65f7e7..d3ed3a826 100644 --- a/test/helpers/browse_helper_test.rb +++ b/test/helpers/browse_helper_test.rb @@ -136,6 +136,33 @@ class BrowseHelperTest < ActionView::TestCase assert_equal "http://wiki.openstreetmap.org/wiki/Tag:highway=primary?uselang=tr", link end + def test_wikidata_link + link = wikidata_link("foo", "Test") + assert_nil link + + link = wikidata_link("wikidata", "http://www.wikidata.org/wiki/Q1") + assert_nil link + + link = wikidata_link("wikidata", "en:Q1") + assert_nil link + + link = wikidata_link("wikidata", "1") + assert_nil link + + link = wikidata_link("wikidata", "Q0123") + assert_nil link + + link = wikidata_link("wikidata", "Q42") + assert_equal "//www.wikidata.org/wiki/Q42?uselang=en", link[:url] + assert_equal "Q42", link[:title] + + I18n.locale = "zh-CN" + + link = wikidata_link("wikidata", "Q1234") + assert_equal "//www.wikidata.org/wiki/Q1234?uselang=zh-CN", link[:url] + assert_equal "Q1234", link[:title] + end + def test_wikipedia_link link = wikipedia_link("wikipedia", "http://en.wikipedia.org/wiki/Full%20URL") assert_nil link