# frozen_string_literal: true require "test_helper" require "proxied_jid" class ProxiedJIDTest < Minitest::Test def test_unproxied jid = ProxiedJID.new(Blather::JID.new("test\\40example.com@example.net")) assert_equal "test@example.com", jid.unproxied.to_s end def test_proxied jid = ProxiedJID.proxy(Blather::JID.new("test@example.com")) assert_equal "test\\40example.com@example.net", jid.to_s end def test_escape jid = ProxiedJID.proxy(Blather::JID.new("test \"&'/:<>", "example.com")) assert_equal( "test\\20\\22\\26\\27\\2f\\3a\\3c\\3e\\40example.com@example.net", jid.to_s ) end def test_backlash_necessary jid = ProxiedJID.proxy(Blather::JID.new("moop\\27@example.com")) assert_equal "moop\\5c27\\40example.com@example.net", jid.to_s end def test_backslash_unnecessary jid = ProxiedJID.proxy(Blather::JID.new("moop\\things@example.com")) assert_equal "moop\\things\\40example.com@example.net", jid.to_s end end