From ac2d34eaf97114c9bde49fe50f35087f634e5914 Mon Sep 17 00:00:00 2001 From: Nate Meyer <672246+notnmeyer@users.noreply.github.com> Date: Tue, 12 May 2026 14:03:47 -0700 Subject: [PATCH] fix --- cmd/agent_context_test.go | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/cmd/agent_context_test.go b/cmd/agent_context_test.go index a0b2d55..690261b 100644 --- a/cmd/agent_context_test.go +++ b/cmd/agent_context_test.go @@ -99,12 +99,12 @@ func TestBuildAgentContext_FlagGroups(t *testing.T) { if upd == nil { t.Fatal("email-messages update not found") } - if !groupListContains(upd.FlagGroups.MutuallyExclusive, []string{"lmx", "lmx-file"}) { - t.Errorf("email-messages update missing mutex group [lmx lmx-file]; got %v", + if !groupContaining(upd.FlagGroups.MutuallyExclusive, "lmx", "lmx-file") { + t.Errorf("email-messages update missing mutex group covering lmx + lmx-file; got %v", upd.FlagGroups.MutuallyExclusive) } - if len(upd.FlagGroups.OneRequired) != 1 { - t.Errorf("email-messages update should have exactly 1 oneRequired group; got %v", + if !groupContaining(upd.FlagGroups.OneRequired, "lmx") { + t.Errorf("email-messages update missing oneRequired group covering content fields; got %v", upd.FlagGroups.OneRequired) } } @@ -286,3 +286,23 @@ func groupListContains(groups [][]string, want []string) bool { } return false } + +func groupContaining(groups [][]string, want ...string) bool { + for _, g := range groups { + have := make(map[string]bool, len(g)) + for _, name := range g { + have[name] = true + } + ok := true + for _, name := range want { + if !have[name] { + ok = false + break + } + } + if ok { + return true + } + } + return false +}