X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/6baccfaddd190d730b626204e9cf81c2504995bf..577b5d5bb8d628c3c5444b7d7e47dceb7acecb4e:/test/unit/short_link_test.rb diff --git a/test/unit/short_link_test.rb b/test/unit/short_link_test.rb index bbae95106..cdc6b3cfd 100644 --- a/test/unit/short_link_test.rb +++ b/test/unit/short_link_test.rb @@ -23,4 +23,19 @@ class ShortLinkTest < ActiveSupport::TestCase assert max_distance > distance, "Maximum expected error exceeded: #{max_distance} <= #{distance} for (#{lat}, #{lon}, #{zoom})." end end + + ## + # test that links are backwards-compatible, so any old links with + # the deprecated @ characters in them still work properly. + def test_deprecated_at_sign + cases = [["~v2juONc--", "@v2juONc--"], + ["as3I3GpG~-", "as3I3GpG@-"], + ["D~hV--", "D@hV--"], + ["CO0O~m8--", "CO0O@m8--"]] + + cases.each do |new_code, old_code| + assert_equal ShortLink.decode(old_code), ShortLink.decode(new_code), + "old (#{old_code}) and new (#{new_code}) should decode to the same location." + end + end end