Add more tests, refactor to fix problems

Signed-off-by: Patrice Ferlet <metal3d@gmail.com>
This commit is contained in:
2024-04-24 20:55:27 +02:00
parent 15a2f25e51
commit da7d92bbfa
8 changed files with 429 additions and 20 deletions

17
cmd/katenary/main_test.go Normal file
View File

@@ -0,0 +1,17 @@
package main
import "testing"
func TestBuildCommand(t *testing.T) {
rootCmd := buildRootCmd()
if rootCmd == nil {
t.Errorf("Expected rootCmd to be defined")
}
if rootCmd.Use != "katenary" {
t.Errorf("Expected rootCmd.Use to be katenary, got %s", rootCmd.Use)
}
numCommands := 5
if len(rootCmd.Commands()) != numCommands {
t.Errorf("Expected %d command, got %d", numCommands, len(rootCmd.Commands()))
}
}