(t *testing.T)
| 13 | ) |
| 14 | |
| 15 | func TestNewLogsCommand(t *testing.T) { |
| 16 | cmd := NewLogsCommand() |
| 17 | |
| 18 | require.NotNil(t, cmd, "NewLogsCommand should not return nil") |
| 19 | assert.Equal(t, "logs [workflow]", cmd.Use, "Command use should be 'logs [workflow]'") |
| 20 | assert.Equal(t, "Download and analyze agentic workflow logs and artifacts", cmd.Short, "Command short description should match") |
| 21 | assert.Contains(t, cmd.Long, "Download and analyze agentic workflow logs", "Command long description should contain expected text") |
| 22 | assert.Contains(t, cmd.Example, "logs --cache-before -1w", "Cache maintenance examples should use the cache-before flag name") |
| 23 | |
| 24 | // Verify flags are registered |
| 25 | flags := cmd.Flags() |
| 26 | |
| 27 | // Check count flag |
| 28 | countFlag := flags.Lookup("count") |
| 29 | assert.NotNil(t, countFlag, "Should have 'count' flag") |
| 30 | assert.Equal(t, "c", countFlag.Shorthand, "Count flag shorthand should be 'c'") |
| 31 | |
| 32 | // Check start-date flag |
| 33 | startDateFlag := flags.Lookup("start-date") |
| 34 | assert.NotNil(t, startDateFlag, "Should have 'start-date' flag") |
| 35 | |
| 36 | // Check end-date flag |
| 37 | endDateFlag := flags.Lookup("end-date") |
| 38 | assert.NotNil(t, endDateFlag, "Should have 'end-date' flag") |
| 39 | |
| 40 | // Check engine flag |
| 41 | engineFlag := flags.Lookup("engine") |
| 42 | assert.NotNil(t, engineFlag, "Should have 'engine' flag") |
| 43 | assert.Empty(t, engineFlag.Shorthand, "Engine filter flag should not have shorthand") |
| 44 | |
| 45 | // Check firewall flags |
| 46 | firewallFlag := flags.Lookup("firewall") |
| 47 | assert.NotNil(t, firewallFlag, "Should have 'firewall' flag") |
| 48 | noFirewallFlag := flags.Lookup("no-firewall") |
| 49 | assert.NotNil(t, noFirewallFlag, "Should have 'no-firewall' flag") |
| 50 | |
| 51 | // Check output flag |
| 52 | outputFlag := flags.Lookup("output") |
| 53 | assert.NotNil(t, outputFlag, "Should have 'output' flag") |
| 54 | assert.Equal(t, "o", outputFlag.Shorthand, "Output flag shorthand should be 'o'") |
| 55 | |
| 56 | // Check ref flag |
| 57 | refFlag := flags.Lookup("ref") |
| 58 | assert.NotNil(t, refFlag, "Should have 'ref' flag") |
| 59 | |
| 60 | // Check run ID filters |
| 61 | afterRunIDFlag := flags.Lookup("after-run-id") |
| 62 | assert.NotNil(t, afterRunIDFlag, "Should have 'after-run-id' flag") |
| 63 | beforeRunIDFlag := flags.Lookup("before-run-id") |
| 64 | assert.NotNil(t, beforeRunIDFlag, "Should have 'before-run-id' flag") |
| 65 | |
| 66 | // Check tool-graph flag |
| 67 | toolGraphFlag := flags.Lookup("tool-graph") |
| 68 | assert.NotNil(t, toolGraphFlag, "Should have 'tool-graph' flag") |
| 69 | |
| 70 | // Check parse flag |
| 71 | parseFlag := flags.Lookup("parse") |
| 72 | assert.NotNil(t, parseFlag, "Should have 'parse' flag") |
nothing calls this directly
no test coverage detected