(t *testing.T)
| 72 | } |
| 73 | |
| 74 | func 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 | |
| 96 | func TestModifyMessageLabels_RejectsOverCap(t *testing.T) { |
| 97 | pool := testutil.TestDB(t) |
nothing calls this directly
no test coverage detected