@@ -122,6 +122,32 @@ func TestRunCLI(t *testing.T) {
122122 }
123123}
124124
125+ // TODO: finish testing different commands?
126+ func TestRunCLI_VariousCommands (t * testing.T ) {
127+ tests := []struct {
128+ name string
129+ args []string
130+ expected int
131+ }{
132+ //{"Invalid command", []string{"foobar"}, 1},
133+ {"Latest flag long" , []string {"--latest" }, 0 },
134+ {"Latest flag short" , []string {"-l" }, 0 },
135+ {"Version flag long" , []string {"--version" }, 0 },
136+ {"Version flag short" , []string {"-v" }, 0 },
137+ //{"Missing Pokémon name", []string{"pokemon"}, 1},
138+ //{"Another invalid command", []string{"invalid"}, 1},
139+ }
140+
141+ for _ , tt := range tests {
142+ t .Run (tt .name , func (t * testing.T ) {
143+ exitCode := runCLI (tt .args )
144+ if exitCode != tt .expected {
145+ t .Errorf ("expected %d, got %d for args %v" , tt .expected , exitCode , tt .args )
146+ }
147+ })
148+ }
149+ }
150+
125151func TestMainFunction (t * testing.T ) {
126152 originalExit := exit
127153 defer func () { exit = originalExit }() // Restore original exit after test
0 commit comments