Refactor Structs for Consistency and Enhanced Readability
- Standardized field formatting in TriggerResult and Execution structs for improved code clarity. - Added test cases in robot_test.go to ensure Robot can run with nil config and quota, verifying default behavior. - Enhanced comments in the Goals struct to clarify task objectives and improve documentation consistency.
This commit is contained in:
parent
90b52eaf22
commit
4ceb74da9e
4 changed files with 38 additions and 23 deletions
|
|
@ -146,12 +146,10 @@ type CurrentState struct {
|
|||
// ## Goals
|
||||
// 1. [High] Analyze sales data and identify trends
|
||||
// - Reason: Sales up 50%, need to understand why
|
||||
// 2. [Normal] Prepare weekly report for manager
|
||||
// - Reason: Friday 5pm, weekly report due
|
||||
// 3. [Low] Update CRM with new leads
|
||||
// - Reason: 3 pending leads from yesterday
|
||||
// - Reason: Friday 5pm, weekly report due
|
||||
type Goals struct {
|
||||
Content string `json:"content"` // markdown text
|
||||
// - Reason: 3 pending leads from yesterday
|
||||
}
|
||||
|
||||
// Task - planned task (structured, for execution)
|
||||
|
|
|
|||
|
|
@ -17,6 +17,23 @@ func TestRobotCanRun(t *testing.T) {
|
|||
assert.True(t, robot.CanRun())
|
||||
})
|
||||
|
||||
t.Run("can run with nil config (uses default quota)", func(t *testing.T) {
|
||||
robot := &types.Robot{
|
||||
Config: nil, // nil config should not panic
|
||||
}
|
||||
// Should not panic and use default max (2)
|
||||
assert.True(t, robot.CanRun())
|
||||
})
|
||||
|
||||
t.Run("can run with nil quota (uses default)", func(t *testing.T) {
|
||||
robot := &types.Robot{
|
||||
Config: &types.Config{
|
||||
Quota: nil, // nil quota should use default
|
||||
},
|
||||
}
|
||||
assert.True(t, robot.CanRun())
|
||||
})
|
||||
|
||||
t.Run("cannot run when at quota", func(t *testing.T) {
|
||||
robot := &types.Robot{
|
||||
Config: &types.Config{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue