Skip to content
This repository was archived by the owner on Jul 22, 2025. It is now read-only.

Commit b5f24a7

Browse files
committed
add a test
1 parent ae938f5 commit b5f24a7

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

spec/models/ai_tool_spec.rb

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -676,6 +676,26 @@ def stub_embeddings
676676
end
677677
end
678678

679+
it "can use sleep function with limits" do
680+
script = <<~JS
681+
function invoke(params) {
682+
let results = [];
683+
for (let i = 0; i < 3; i++) {
684+
let result = sleep(1); // 1ms sleep
685+
results.push(result);
686+
}
687+
return results;
688+
}
689+
JS
690+
691+
tool = create_tool(script: script)
692+
runner = tool.runner({}, llm: nil, bot_user: nil)
693+
694+
result = runner.invoke
695+
696+
expect(result).to eq([{ "slept" => 1 }, { "slept" => 1 }, { "slept" => 1 }])
697+
end
698+
679699
describe "upload URL resolution" do
680700
it "can resolve upload short URLs to public URLs" do
681701
upload =

0 commit comments

Comments
 (0)