|
500 | 500 | (testing "plain prompt message" |
501 | 501 | (is (= {:type :prompt-message |
502 | 502 | :message "Hello world"} |
503 | | - (#'f.chat/message->decision "Hello world")))) |
| 503 | + (#'f.chat/message->decision "Hello world" {} {})))) |
| 504 | + (testing "message starting with a absolute path" |
| 505 | + (is (= {:type :prompt-message |
| 506 | + :message "/path/to/file check this out"} |
| 507 | + (#'f.chat/message->decision "/path/to/file check this out" {} {})))) |
504 | 508 | (testing "ECA command without args" |
505 | 509 | (is (= {:type :eca-command |
506 | | - :command "help" |
| 510 | + :command "doctor" |
507 | 511 | :args []} |
508 | | - (#'f.chat/message->decision "/help")))) |
| 512 | + (#'f.chat/message->decision "/doctor" {} {})))) |
509 | 513 | (testing "ECA command with args" |
510 | 514 | (is (= {:type :eca-command |
511 | | - :command "search" |
| 515 | + :command "login" |
512 | 516 | :args ["foo" "bar"]} |
513 | | - (#'f.chat/message->decision "/search foo bar")))) |
| 517 | + (#'f.chat/message->decision "/login foo bar" {} {})))) |
514 | 518 | (testing "ECA command with args with spaces in quotes" |
515 | 519 | (is (= {:type :eca-command |
516 | | - :command "search" |
| 520 | + :command "login" |
517 | 521 | :args ["foo bar" "baz" "qux bla blow"]} |
518 | | - (#'f.chat/message->decision "/search \"foo bar\" baz \"qux bla blow\"")))) |
519 | | - (testing "MCP prompt without args" |
520 | | - (is (= {:type :mcp-prompt |
521 | | - :server "server" |
522 | | - :prompt "prompt" |
523 | | - :args []} |
524 | | - (#'f.chat/message->decision "/server:prompt")))) |
525 | | - (testing "MCP prompt with args" |
526 | | - (is (= {:type :mcp-prompt |
527 | | - :server "server" |
528 | | - :prompt "prompt" |
529 | | - :args ["arg1" "arg2"]} |
530 | | - (#'f.chat/message->decision "/server:prompt arg1 arg2"))))) |
| 522 | + (#'f.chat/message->decision "/login \"foo bar\" baz \"qux bla blow\"" {} {})))) |
| 523 | + (with-redefs [f.mcp/all-prompts (constantly [{:name "prompt" |
| 524 | + :server "server"}])] |
| 525 | + (testing "MCP prompt without args" |
| 526 | + (is (= {:type :mcp-prompt |
| 527 | + :server "server" |
| 528 | + :prompt "prompt" |
| 529 | + :args []} |
| 530 | + (#'f.chat/message->decision "/server:prompt" {} {})))) |
| 531 | + (testing "MCP prompt with args" |
| 532 | + (is (= {:type :mcp-prompt |
| 533 | + :server "server" |
| 534 | + :prompt "prompt" |
| 535 | + :args ["arg1" "arg2"]} |
| 536 | + (#'f.chat/message->decision "/server:prompt arg1 arg2" {} {})))))) |
0 commit comments