diff --git a/test/mcp/annotations_test.rb b/test/mcp/annotations_test.rb index 4253cd50..60bfa722 100644 --- a/test/mcp/annotations_test.rb +++ b/test/mcp/annotations_test.rb @@ -32,7 +32,7 @@ def test_initialization_by_default assert_nil(annotations.priority) assert_nil(annotations.last_modified) - assert_empty(annotations.to_h) + assert_equal({}, annotations.to_h) end def test_initialization_with_partial_attributes diff --git a/test/mcp/client_test.rb b/test/mcp/client_test.rb index 71422ee6..fcbff95a 100644 --- a/test/mcp/client_test.rb +++ b/test/mcp/client_test.rb @@ -41,7 +41,7 @@ def test_tools_returns_empty_array_when_no_tools client = Client.new(transport: transport) tools = client.tools - assert_empty(tools) + assert_equal([], tools) end def test_call_tool_sends_request_to_transport_and_returns_content @@ -102,7 +102,7 @@ def test_resources_returns_empty_array_when_no_resources client = Client.new(transport: transport) resources = client.resources - assert_empty(resources) + assert_equal([], resources) end def test_read_resource_sends_request_to_transport_and_returns_contents @@ -142,7 +142,7 @@ def test_read_resource_returns_empty_array_when_no_contents client = Client.new(transport: transport) contents = client.read_resource(uri: uri) - assert_empty(contents) + assert_equal([], contents) end def test_resource_templates_sends_request_to_transport_and_returns_resource_templates_array @@ -179,7 +179,7 @@ def test_resource_templates_returns_empty_array_when_no_resource_templates client = Client.new(transport: transport) resource_templates = client.resource_templates - assert_empty(resource_templates) + assert_equal([], resource_templates) end def test_prompts_sends_request_to_transport_and_returns_prompts_array @@ -244,7 +244,7 @@ def test_prompts_returns_empty_array_when_no_prompts client = Client.new(transport: transport) prompts = client.prompts - assert_empty(prompts) + assert_equal([], prompts) end def test_get_prompt_sends_request_to_transport_and_returns_contents @@ -290,7 +290,7 @@ def test_get_prompt_returns_empty_hash_when_no_contents client = Client.new(transport: transport) contents = client.get_prompt(name: name) - assert_empty(contents) + assert_equal({}, contents) end def test_get_prompt_returns_empty_hash @@ -303,7 +303,7 @@ def test_get_prompt_returns_empty_hash client = Client.new(transport: transport) contents = client.get_prompt(name: name) - assert_empty(contents) + assert_equal({}, contents) end end end diff --git a/test/mcp/icon_test.rb b/test/mcp/icon_test.rb index a4ac1191..e8c837cd 100644 --- a/test/mcp/icon_test.rb +++ b/test/mcp/icon_test.rb @@ -23,7 +23,7 @@ def test_initialization_by_default assert_nil(icon.src) assert_nil(icon.theme) - assert_empty(icon.to_h) + assert_equal({}, icon.to_h) end def test_valid_theme_for_light diff --git a/test/mcp/server/transports/stdio_notification_integration_test.rb b/test/mcp/server/transports/stdio_notification_integration_test.rb index fd4defdd..c20fc069 100644 --- a/test/mcp/server/transports/stdio_notification_integration_test.rb +++ b/test/mcp/server/transports/stdio_notification_integration_test.rb @@ -213,7 +213,7 @@ def puts(message) # This test verifies the complete integration from server to transport # Start with no output - assert_empty @mock_stdout.output + assert_equal([], @mock_stdout.output) # Add a prompt and notify @server.define_prompt( diff --git a/test/mcp/server/transports/stdio_transport_test.rb b/test/mcp/server/transports/stdio_transport_test.rb index 48acf46f..aa65ccbd 100644 --- a/test/mcp/server/transports/stdio_transport_test.rb +++ b/test/mcp/server/transports/stdio_transport_test.rb @@ -45,7 +45,7 @@ class StdioTransportTest < ActiveSupport::TestCase response = JSON.parse(output.string, symbolize_names: true) assert_equal("2.0", response[:jsonrpc]) assert_equal("123", response[:id]) - assert_empty(response[:result]) + assert_equal({}, response[:result]) refute(@transport.instance_variable_get(:@open)) ensure $stdin = original_stdin diff --git a/test/mcp/server/transports/streamable_http_transport_test.rb b/test/mcp/server/transports/streamable_http_transport_test.rb index 55bae1c4..721e09ba 100644 --- a/test/mcp/server/transports/streamable_http_transport_test.rb +++ b/test/mcp/server/transports/streamable_http_transport_test.rb @@ -46,7 +46,7 @@ class StreamableHTTPTransportTest < ActiveSupport::TestCase body = JSON.parse(response[2][0]) assert_equal "2.0", body["jsonrpc"] assert_equal "123", body["id"] - assert_empty(body["result"]) + assert_equal({}, body["result"]) end test "handles POST request with invalid JSON" do @@ -315,7 +315,7 @@ class StreamableHTTPTransportTest < ActiveSupport::TestCase @transport.close # Verify session was cleaned up - assert_empty @transport.instance_variable_get(:@sessions) + assert_equal({}, @transport.instance_variable_get(:@sessions)) end test "sends notification to correct session with multiple active sessions" do @@ -847,7 +847,7 @@ class StreamableHTTPTransportTest < ActiveSupport::TestCase response = stateless_transport.handle_request(request) assert_equal 202, response[0] - assert_empty(response[1]) + assert_equal({}, response[1]) body = response[2][0] assert_nil(body) @@ -896,8 +896,8 @@ class StreamableHTTPTransportTest < ActiveSupport::TestCase response = @transport.handle_request(notif_request) assert_equal 202, response[0] - assert_empty(response[1]) - assert_empty(response[2]) + assert_equal({}, response[1]) + assert_equal([], response[2]) end test "handles POST request with body including JSON-RPC response object and returns with no body" do @@ -922,8 +922,8 @@ class StreamableHTTPTransportTest < ActiveSupport::TestCase response = @transport.handle_request(request) assert_equal 202, response[0] - assert_empty(response[1]) - assert_empty(response[2]) + assert_equal({}, response[1]) + assert_equal([], response[2]) end private diff --git a/test/mcp/server_test.rb b/test/mcp/server_test.rb index d6a9b1b7..ce16dcd9 100644 --- a/test/mcp/server_test.rb +++ b/test/mcp/server_test.rb @@ -824,7 +824,7 @@ class Example < Tool assert_equal "2.0", response[:jsonrpc] assert_equal 1, response[:id] - assert_empty(response[:result]) + assert_equal({}, response[:result]) refute response.key?(:error) end diff --git a/test/mcp/tool/input_schema_test.rb b/test/mcp/tool/input_schema_test.rb index 45f98a0a..c48d58c7 100644 --- a/test/mcp/tool/input_schema_test.rb +++ b/test/mcp/tool/input_schema_test.rb @@ -33,7 +33,7 @@ class InputSchemaTest < ActiveSupport::TestCase test "missing_required_arguments returns an empty array if no required arguments are missing" do input_schema = InputSchema.new(properties: { message: { type: "string" } }, required: ["message"]) - assert_empty input_schema.missing_required_arguments({ message: "Hello, world!" }) + assert_equal([], input_schema.missing_required_arguments({ message: "Hello, world!" })) end test "valid schema initialization" do diff --git a/test/mcp/tool/response_test.rb b/test/mcp/tool/response_test.rb index 5fd70a85..6277e18b 100644 --- a/test/mcp/tool/response_test.rb +++ b/test/mcp/tool/response_test.rb @@ -107,7 +107,7 @@ class ResponseTest < ActiveSupport::TestCase actual = response.to_h assert_equal [:content, :isError, :structuredContent], actual.keys - assert_empty actual[:content] + assert_equal([], actual[:content]) assert_equal structured_content, actual[:structuredContent] refute actual[:isError] end @@ -118,7 +118,7 @@ class ResponseTest < ActiveSupport::TestCase actual = response.to_h assert_equal [:content, :isError, :structuredContent], actual.keys - assert_empty actual[:content] + assert_equal([], actual[:content]) assert_equal structured_content, actual[:structuredContent] refute actual[:isError] end