Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion test/mcp/annotations_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 7 additions & 7 deletions test/mcp/client_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
2 changes: 1 addition & 1 deletion test/mcp/icon_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion test/mcp/server/transports/stdio_transport_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 7 additions & 7 deletions test/mcp/server/transports/streamable_http_transport_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/mcp/server_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion test/mcp/tool/input_schema_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions test/mcp/tool/response_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down