diff options
| author | Adam Malczewski <[email protected]> | 2026-04-01 23:14:45 +0900 |
|---|---|---|
| committer | Adam Malczewski <[email protected]> | 2026-04-01 23:14:45 +0900 |
| commit | a57cb89b3546845e9db2fcd45e4a8f16ade09b31 (patch) | |
| tree | be3b186e8474f8cf79c464fe0fb35eca40614a64 /spec | |
| parent | cc97aeb35f8e0f61a13ee28b94355afa7c884281 (diff) | |
| download | dispatch-tools-interface-a57cb89b3546845e9db2fcd45e4a8f16ade09b31.tar.gz dispatch-tools-interface-a57cb89b3546845e9db2fcd45e4a8f16ade09b31.zip | |
minor updatedev
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/dispatch/tools/definition_spec.rb | 10 | ||||
| -rw-r--r-- | spec/dispatch/tools/registry_spec.rb | 28 | ||||
| -rw-r--r-- | spec/dispatch/tools/result_spec.rb | 20 |
3 files changed, 29 insertions, 29 deletions
diff --git a/spec/dispatch/tools/definition_spec.rb b/spec/dispatch/tools/definition_spec.rb index c9640e2..ada2012 100644 --- a/spec/dispatch/tools/definition_spec.rb +++ b/spec/dispatch/tools/definition_spec.rb @@ -9,7 +9,7 @@ RSpec.describe Dispatch::Tools::Definition do start_line: { type: "integer", description: "Start line (0-based)" }, end_line: { type: "integer", description: "End line (0-based, -1 for EOF)" } }, - required: ["path"] + required: [ "path" ] } end @@ -171,10 +171,10 @@ RSpec.describe Dispatch::Tools::Definition do hash = tool.to_h expect(hash).to eq({ - name: "read_file", - description: "Read the contents of a file", - parameters: parameters_schema - }) + name: "read_file", + description: "Read the contents of a file", + parameters: parameters_schema + }) end it "returns a plain hash, not a struct" do diff --git a/spec/dispatch/tools/registry_spec.rb b/spec/dispatch/tools/registry_spec.rb index fc7332c..9574f19 100644 --- a/spec/dispatch/tools/registry_spec.rb +++ b/spec/dispatch/tools/registry_spec.rb @@ -10,7 +10,7 @@ RSpec.describe Dispatch::Tools::Registry do properties: { path: { type: "string" } }, - required: ["path"] + required: [ "path" ] } ) { |params, _context| Dispatch::Tools::Result.success(output: "contents of #{params[:path]}") } end @@ -39,7 +39,7 @@ RSpec.describe Dispatch::Tools::Registry do properties: { path: { type: "string" } }, - required: ["path"] + required: [ "path" ] } ) { |_params, _context| Dispatch::Tools::Result.success(output: "deleted") } end @@ -88,8 +88,8 @@ RSpec.describe Dispatch::Tools::Registry do expect(tool).to be(read_file_tool) end - it "raises ToolNotFoundError for unknown tool name" do - expect { registry.get("nonexistent") }.to raise_error(Dispatch::Tools::ToolNotFoundError) + it "returns nil for unknown tool name" do + expect(registry.get("nonexistent")).to be_nil end end @@ -142,16 +142,16 @@ RSpec.describe Dispatch::Tools::Registry do expect(result).to be_an(Array) expect(result.size).to eq(1) expect(result.first).to eq({ - name: "read_file", - description: "Read the contents of a file", - parameters: { - type: "object", - properties: { - path: { type: "string" } - }, - required: ["path"] - } - }) + name: "read_file", + description: "Read the contents of a file", + parameters: { + type: "object", + properties: { + path: { type: "string" } + }, + required: [ "path" ] + } + }) end it "returns plain hashes, not structs" do diff --git a/spec/dispatch/tools/result_spec.rb b/spec/dispatch/tools/result_spec.rb index 17c9d7f..cd33368 100644 --- a/spec/dispatch/tools/result_spec.rb +++ b/spec/dispatch/tools/result_spec.rb @@ -72,22 +72,22 @@ RSpec.describe Dispatch::Tools::Result do result = described_class.success(output: "data", metadata: { flag: true }) expect(result.to_h).to eq({ - success: true, - output: "data", - error: nil, - metadata: { flag: true } - }) + success: true, + output: "data", + error: nil, + metadata: { flag: true } + }) end it "returns a hash with all fields for a failure result" do result = described_class.failure(error: "oops") expect(result.to_h).to eq({ - success: false, - output: nil, - error: "oops", - metadata: {} - }) + success: false, + output: nil, + error: "oops", + metadata: {} + }) end end |
