Files
multica/server/internal/handler/issue_table_status_order_test.go
7dafc0cd62 MUL-7240: Unify issue lifecycle into four stored categories (#8261)
* feat: simplify issue status categories

Co-authored-by: multica-agent <[email protected]>

* feat: adopt four stored issue lifecycle categories

Co-authored-by: multica-agent <[email protected]>

* fix: preserve visible work when upgrading saved category preferences

Co-authored-by: multica-agent <[email protected]>

* docs: align lifecycle comments with stored and wire contracts

Co-authored-by: multica-agent <[email protected]>

* test: align mobile grouping expectations with four categories

Co-authored-by: multica-agent <[email protected]>

* fix(issues): group user views by concrete status keys

Co-authored-by: multica-agent <[email protected]>

* fix(settings): simplify status editor copy and category selector

Co-authored-by: multica-agent <[email protected]>

* feat(statuses): allow ordering built-ins and unify row actions

Co-authored-by: multica-agent <[email protected]>

* feat(statuses): configure custom status icons independently of category

Co-authored-by: multica-agent <[email protected]>

* fix(statuses): dismiss built-in status notice

Co-authored-by: multica-agent <[email protected]>

* fix(issue-status): require moving issues before archive and polish controls

Co-authored-by: multica-agent <[email protected]>

* fix(ci): renumber issue status migrations after main updates

Co-authored-by: multica-agent <[email protected]>

* fix(statuses): isolate archive inspection and align catalog behavior

Co-authored-by: multica-agent <[email protected]>

* fix(statuses): respect injectable catalog for table grouping

Co-authored-by: multica-agent <[email protected]>

* refactor(statuses): simplify built-in skill and runtime guidance

Co-authored-by: multica-agent <[email protected]>

---------

Co-authored-by: Lambda <[email protected]>
Co-authored-by: multica-agent <[email protected]>
2026-09-14 12:57:24 +08:00

39 lines
1.4 KiB
Go

package handler
import (
"reflect"
"testing"
db "github.com/multica-ai/multica/server/pkg/db/generated"
)
func TestIssueTableStatusOrder(t *testing.T) {
entries := []db.IssueStatus{
{Key: "qa", Category: "started", Position: -1},
{Key: "in_progress", Category: "started", Position: 20, IsSystem: true},
{Key: "blocked", Category: "started", Position: 10, IsSystem: true},
{Key: "in_review", Category: "started", Position: 0, IsSystem: true},
{Key: "shipped", Category: "done", Position: -100},
}
want := []string{"backlog", "todo", "qa", "in_review", "blocked", "in_progress", "shipped", "done", "cancelled"}
got := issueTableStatusOrder(entries)
if !reflect.DeepEqual(got, want) {
t.Fatalf("order = %v, want %v", got, want)
}
if entries[0].Key != "qa" {
t.Fatal("ordering mutated the catalog")
}
var argument any
expression := (resolvedIssueTableGroup{kind: "status", statusOrder: got}).orderExpression(func(value any) string { argument = value; return "$2" })
if expression != "COALESCE(array_position($2::text[], group_value), 100000)" || !reflect.DeepEqual(argument, want) {
t.Fatalf("unparameterized or incorrect order: %s %v", expression, argument)
}
}
func TestIssueTableStatusSeedOrder(t *testing.T) {
want := []string{"backlog", "todo", "in_progress", "in_review", "blocked", "done", "cancelled"}
if got := issueTableStatusOrder(nil); !reflect.DeepEqual(got, want) {
t.Fatalf("unseeded order = %v", got)
}
}