]> git.openstreetmap.org Git - rails.git/blob - test/lib/tag2link_test.rb
Move tag2link_link logic to module
[rails.git] / test / lib / tag2link_test.rb
1 # frozen_string_literal: true
2
3 require "test_helper"
4
5 class Tag2linkTest < ActiveSupport::TestCase
6   def test_link_returns_nil_for_full_url
7     assert_nil Tag2link.link("website", "https://example.com/page")
8   end
9
10   def test_link_returns_nil_for_unknown_key
11     assert_nil Tag2link.link("nonexistent_key", "SomeValue")
12   end
13
14   def test_link_returns_proper_url_for_known_key
15     url = Tag2link.link("wikidata", "Q936")
16     assert_equal "https://www.wikidata.org/entity/Q936", url
17   end
18 end