test: adapt alias e2e tests to current behavior
Build and Publish Arch Package / build-arch (amd64, x86_64) (push) Successful in 50s
Build and Publish Arch Package / build-arch (arm64, aarch64) (push) Successful in 50s
Build and Publish Docker Image / build-apk (amd64, x86_64) (push) Successful in 45s
Build and Publish Docker Image / build-apk (arm64, aarch64) (push) Successful in 46s
Build and Publish Docker Image / build-and-push-docker (push) Successful in 10m50s
Build and Publish Arch Package / build-arch (amd64, x86_64) (push) Successful in 50s
Build and Publish Arch Package / build-arch (arm64, aarch64) (push) Successful in 50s
Build and Publish Docker Image / build-apk (amd64, x86_64) (push) Successful in 45s
Build and Publish Docker Image / build-apk (arm64, aarch64) (push) Successful in 46s
Build and Publish Docker Image / build-and-push-docker (push) Successful in 10m50s
This commit is contained in:
@@ -2,7 +2,6 @@ package e2e_test
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"slices"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
@@ -10,20 +9,14 @@ import (
|
||||
func TestAliases(t *testing.T) {
|
||||
env := newTestEnv(t, "testuser")
|
||||
|
||||
t.Run("DefaultsPresent", func(t *testing.T) {
|
||||
t.Run("EmptyByDefault", func(t *testing.T) {
|
||||
out := env.mustAx("alias", "--json")
|
||||
var aliases []map[string]string
|
||||
if err := json.Unmarshal([]byte(out), &aliases); err != nil {
|
||||
t.Fatalf("failed to parse alias JSON: %v\n%s", err, out)
|
||||
}
|
||||
names := make([]string, len(aliases))
|
||||
for i, a := range aliases {
|
||||
names[i] = a["name"]
|
||||
}
|
||||
for _, want := range []string{"mine", "due", "inbox"} {
|
||||
if !slices.Contains(names, want) {
|
||||
t.Errorf("default alias %q not found in: %v", want, names)
|
||||
}
|
||||
if len(aliases) != 0 {
|
||||
t.Errorf("expected no aliases by default, got: %v", aliases)
|
||||
}
|
||||
})
|
||||
|
||||
@@ -46,22 +39,18 @@ func TestAliases(t *testing.T) {
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("CannotDeleteDefault", func(t *testing.T) {
|
||||
_, err := env.ax("alias", "del", "inbox")
|
||||
if err == nil {
|
||||
t.Fatal("expected error deleting default alias, got none")
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("Execute_Due", func(t *testing.T) {
|
||||
// The built-in 'due' alias lists open issues.
|
||||
env.mustAx("alias", "due", "list --due")
|
||||
out := env.mustAx("due", "--json")
|
||||
env.parseNodes(out)
|
||||
env.mustAx("alias", "del", "due")
|
||||
})
|
||||
|
||||
t.Run("Execute_Mine_WithMeExpansion", func(t *testing.T) {
|
||||
// 'mine' expands $me to AX_USER=testuser.
|
||||
env.mustAx("alias", "mine", "list --assignee $me")
|
||||
out := env.mustAx("mine", "--json")
|
||||
env.parseNodes(out)
|
||||
env.mustAx("alias", "del", "mine")
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user