MCPcopy Create free account
hub / github.com/Mnexa-AI/e2a / TestModifyMessageLabels_RemoveAndOverlap

Function TestModifyMessageLabels_RemoveAndOverlap

internal/identity/labels_test.go:74–94  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

72}
73
74func TestModifyMessageLabels_RemoveAndOverlap(t *testing.T) {
75 pool := testutil.TestDB(t)
76 store := identity.NewStore(pool)
77 ctx := context.Background()
78
79 msgID, agentID := labelsTestSetup(t, store, "labels-remove")
80
81 if _, err := store.ModifyMessageLabels(ctx, msgID, agentID, []string{"a", "b", "c"}, nil); err != nil {
82 t.Fatalf("seed: %v", err)
83 }
84 // "b" appears in both add and remove — remove wins (the union-then-difference
85 // semantics documented on ModifyMessageLabels).
86 final, err := store.ModifyMessageLabels(ctx, msgID, agentID, []string{"b", "d"}, []string{"b", "a"})
87 if err != nil {
88 t.Fatalf("ModifyMessageLabels: %v", err)
89 }
90 want := []string{"c", "d"}
91 if !reflect.DeepEqual(final, want) {
92 t.Errorf("labels = %v, want %v", final, want)
93 }
94}
95
96func TestModifyMessageLabels_RejectsOverCap(t *testing.T) {
97 pool := testutil.TestDB(t)

Callers

nothing calls this directly

Calls 4

ModifyMessageLabelsMethod · 0.95
TestDBFunction · 0.92
NewStoreFunction · 0.92
labelsTestSetupFunction · 0.85

Tested by

no test coverage detected