feat: app cmd ls

See coop-cloud/organising#484
This commit is contained in:
2023-10-17 21:16:31 +02:00
parent 6a673ef101
commit 254df7f2be
3 changed files with 116 additions and 4 deletions

View File

@ -5,6 +5,7 @@ import (
"os"
"path"
"reflect"
"slices"
"strings"
"testing"
@ -115,6 +116,31 @@ func TestReadAbraShEnvVars(t *testing.T) {
}
}
func TestReadAbraShCmdNames(t *testing.T) {
offline := true
r, err := recipe.Get("abra-test-recipe", offline)
if err != nil {
t.Fatal(err)
}
abraShPath := fmt.Sprintf("%s/%s/%s", config.RECIPES_DIR, r.Name, "abra.sh")
cmdNames, err := config.ReadAbraShCmdNames(abraShPath)
if err != nil {
t.Fatal(err)
}
if len(cmdNames) == 0 {
t.Error("at least one command name should be found")
}
expectedCmdNames := []string{"test_cmd", "test_cmd_args"}
for _, cmdName := range expectedCmdNames {
if !slices.Contains(cmdNames, cmdName) {
t.Fatalf("%s should have been found in %s", cmdName, abraShPath)
}
}
}
func TestCheckEnv(t *testing.T) {
offline := true
r, err := recipe.Get("abra-test-recipe", offline)