@@ -826,6 +826,62 @@ defmodule M51.IrcConn.HandlerTest do
826826 assert_line ( "BATCH :-#{ batch_id } \r \n " )
827827 end
828828
829+ test "MODE on user" , % { handler: handler } do
830+ do_connection_registration ( handler )
831+
832+ send ( handler , cmd ( "@label=l1 MODE unknown_user:example.com" ) )
833+
834+ assert_line (
835+ "@label=l1 :server. 502 foo:example.org :Can't view mode of other users\r \n "
836+ )
837+
838+ send ( handler , cmd ( "@label=l2 MODE foo:example.org" ) )
839+
840+ assert_line (
841+ "@label=l2 :server. 221 foo:example.org :+i\r \n "
842+ )
843+
844+ send ( handler , cmd ( "@label=l3 MODE unknown_user:example.com +i" ) )
845+
846+ assert_line (
847+ "@label=l3 :server. 502 foo:example.org :Can't set mode of other users\r \n "
848+ )
849+
850+ send ( handler , cmd ( "@label=l4 MODE foo:example.org +i" ) )
851+
852+ assert_line (
853+ "@label=l4 :server. 501 foo:example.org :Setting user modes are not supported\r \n "
854+ )
855+ end
856+
857+ test "MODE on channel" , % { handler: handler } do
858+ do_connection_registration ( handler )
859+
860+ send ( handler , cmd ( "@label=l1 MODE #unknown_channel:example.com" ) )
861+
862+ assert_line (
863+ "@label=l1 :server. 324 foo:example.org #unknown_channel:example.com :+nt\r \n "
864+ )
865+
866+ send ( handler , cmd ( "@label=l2 MODE !unknown_channel:example.com" ) )
867+
868+ assert_line (
869+ "@label=l2 :server. 324 foo:example.org !unknown_channel:example.com :+nt\r \n "
870+ )
871+
872+ send ( handler , cmd ( "@label=l3 MODE #unknown_channel:example.com +i" ) )
873+
874+ assert_line (
875+ "@label=l3 :server. 482 foo:example.org #unknown_channel:example.com :You're not a channel operator\r \n "
876+ )
877+
878+ send ( handler , cmd ( "@label=l4 MODE !unknown_channel:example.com +i" ) )
879+
880+ assert_line (
881+ "@label=l4 :server. 482 foo:example.org !unknown_channel:example.com :You're not a channel operator\r \n "
882+ )
883+ end
884+
829885 test "CHATHISTORY AROUND" , % { handler: handler } do
830886 do_connection_registration ( handler , [ "message-tags" ] )
831887
0 commit comments