feat: 添加测试框架及功能测试用例
test: 实现BDD测试框架及功能测试 docs: 添加测试配置文件及文档 refactor: 重构命令处理逻辑以支持测试
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
Feature: /new command — create a Claude Code session
|
||||
|
||||
Background:
|
||||
Given user "user_abc123" is sending commands
|
||||
|
||||
Scenario: No arguments shows usage
|
||||
When user sends "/new"
|
||||
Then reply contains "Usage: /new"
|
||||
|
||||
Scenario: Creates session with valid directory
|
||||
Given run_claude returns "Session ready."
|
||||
When user sends "/new myproject"
|
||||
Then reply contains "myproject"
|
||||
And session manager has 1 session for user "user_abc123"
|
||||
|
||||
Scenario: Creates session with initial message
|
||||
Given run_claude returns "Fixed the bug."
|
||||
When user sends "/new myproject fix the login bug"
|
||||
Then reply contains "myproject"
|
||||
|
||||
Scenario: Path traversal attempt is blocked
|
||||
When user sends "/new ../../etc"
|
||||
Then reply contains "Error"
|
||||
And session manager has 0 sessions for user "user_abc123"
|
||||
|
||||
Scenario: Custom timeout is accepted
|
||||
Given run_claude returns "Done."
|
||||
When user sends "/new myproject --timeout 60"
|
||||
Then reply contains "myproject"
|
||||
And reply contains "timeout: 60s"
|
||||
|
||||
Scenario: Creates session and sends card when chat_id is set
|
||||
Given the current chat_id is "chat_xyz"
|
||||
And run_claude returns "Ready."
|
||||
When user sends "/new myproject"
|
||||
Then a sessions card is sent to chat "chat_xyz"
|
||||
And text reply is empty
|
||||
Reference in New Issue
Block a user