|
1 | 1 | # frozen_string_literal: true |
2 | 2 |
|
3 | 3 | require "test_helper" |
| 4 | +require "mcp/client/tools" |
| 5 | +require "mcp/client/tool" |
4 | 6 |
|
5 | | -module ModelContextProtocol |
| 7 | +module MCP |
6 | 8 | module Client |
7 | 9 | class ToolsTest < Minitest::Test |
8 | 10 | def test_each_iterates_over_tools |
@@ -43,23 +45,23 @@ def test_handles_empty_tools_array |
43 | 45 | response = { "result" => { "tools" => [] } } |
44 | 46 | tools = Tools.new(response) |
45 | 47 |
|
46 | | - assert_equal([], tools.all) |
| 48 | + assert_empty(tools.all) |
47 | 49 | assert_equal(0, tools.count) |
48 | 50 | end |
49 | 51 |
|
50 | 52 | def test_handles_missing_tools_key |
51 | 53 | response = { "result" => {} } |
52 | 54 | tools = Tools.new(response) |
53 | 55 |
|
54 | | - assert_equal([], tools.all) |
| 56 | + assert_empty(tools.all) |
55 | 57 | assert_equal(0, tools.count) |
56 | 58 | end |
57 | 59 |
|
58 | 60 | def test_handles_missing_result_key |
59 | 61 | response = {} |
60 | 62 | tools = Tools.new(response) |
61 | 63 |
|
62 | | - assert_equal([], tools.all) |
| 64 | + assert_empty(tools.all) |
63 | 65 | assert_equal(0, tools.count) |
64 | 66 | end |
65 | 67 |
|
@@ -87,9 +89,9 @@ def test_includes_enumerable |
87 | 89 | response = { "result" => { "tools" => [] } } |
88 | 90 | tools = Tools.new(response) |
89 | 91 |
|
90 | | - assert(tools.respond_to?(:map)) |
91 | | - assert(tools.respond_to?(:select)) |
92 | | - assert(tools.respond_to?(:find)) |
| 92 | + assert_respond_to(tools, :map) |
| 93 | + assert_respond_to(tools, :select) |
| 94 | + assert_respond_to(tools, :find) |
93 | 95 | end |
94 | 96 | end |
95 | 97 | end |
|
0 commit comments