From ae8dbbbd362ccbb14ec25c944553573b485318af Mon Sep 17 00:00:00 2001 From: Phillip Davis Date: Tue, 3 Mar 2026 16:08:11 -0500 Subject: [PATCH] test(disco-info): gateway returns gateway identity --- test/property/test_disco_info.rb | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/test/property/test_disco_info.rb b/test/property/test_disco_info.rb index db201bf91cd5d8ba889556ee28d8d966e7bc4c85..039db1cae732b7be08afe1e47f6bd7b2fce41d2e 100644 --- a/test/property/test_disco_info.rb +++ b/test/property/test_disco_info.rb @@ -40,4 +40,32 @@ class DiscoInfoPropertyTest < Minitest::Test } end em :test_disco_info_get_for_user_returns_user_caps + + def test_disco_info_get_for_gateway_returns_gateway_identity + property_of { + DiscoInfoIQ + .new(REDIS) + .target_node { nil } + .generate + }.check { |_metadata, example| + process_stanza(example['stanza']) + + assert_equal 1, written.length + reply = written.shift + + assert_equal example['jid'], reply.to.to_s + + ns = 'http://jabber.org/protocol/disco#info' + ids = reply.query.find('.//ns:identity', ns: ns) + gateway_id = ids.find { |i| i[:category] == 'gateway' } + assert gateway_id, 'Should include gateway identity' + assert_equal 'sms', gateway_id[:type] + + feats = reply.query.find('.//ns:feature', ns: ns).map { |f| f[:var] } + assert_includes feats, 'http://jabber.org/protocol/disco#info' + assert_includes feats, 'jabber:iq:register' + assert_includes feats, 'http://jabber.org/protocol/commands' + } + end + em :test_disco_info_get_for_gateway_returns_gateway_identity end