feat(jtk): add init command and config test#48
Conversation
TDD Quality Assessment for PR #48SummaryThis PR adds What's Good1. Consistent Testing Patterns
2. Core Paths Covered
What's Missing1. Interactive Mode Tests (Critical Gap)
2. Existing Config Overwrite Flow
3.
4. URL Normalization
5.
6. Output Verification
Suggested Additional Tests// initcmd_test.go
func TestRunInit_InteractiveMode(t *testing.T) {
// Test full interactive flow with all prompts
server := setupMockServer(t)
opts := newTestRootOptions()
opts.Stdin = strings.NewReader("y\nhttps://test.atlassian.net\nuser@example.com\ntoken123\n")
err := runInit(opts, "", "", "", false)
require.NoError(t, err)
// Assert prompts appeared, connection verified, config saved
}
func TestRunInit_ExistingConfig_DeclineOverwrite(t *testing.T) {
// Setup existing config, answer "n" to overwrite
// Should return nil and output "Setup cancelled"
}
func TestPromptRequired_EmptyThenValid(t *testing.T) {
// First empty, then valid - tests retry loop
reader := bufio.NewReader(strings.NewReader("\nhello\n"))
got, err := promptRequired(reader, "Test")
require.NoError(t, err)
assert.Equal(t, "hello", got)
}
// configcmd_test.go
func TestNewTestCmd_ClientCreationFailure(t *testing.T) {
// Test path where opts.APIClient() returns an error
}
func TestNewTestCmd_ServerError(t *testing.T) {
// 500 response should show error and troubleshooting hints
}Assessment Summary
Overall: Good foundation, but interactive mode and edge cases need coverage before this represents thorough TDD. The tests cover ~60% of the functionality. The untested 40% is primarily the interactive prompting flow, which is a significant part of the user experience for |
Summary
jtk initcommand for interactive guided setup wizard--no-verifyto skip)jtk config testcommand for connectivity verificationPorts init wizard and config test from jira-ticket-cli PR #59.
Closes #39
Test plan
make buildpassesmake testpassesmake lintpassesjtk initjtk config test🤖 Generated with Claude Code