[core-be-agent] fix vet warnings: unused variables in hub_test and bundle_helpers_test

Per QA review of PR #794:

1. hub_test.go TestNewHub_WithAccessChecker: `called` was set but never
   read (unused variable → go vet failure). Added assertion that checks
   `called` is true after verifying the access checker was invoked.

2. bundle_helpers_test.go TestSplitLines_Empty: `want` was declared as
   []string{""} but only len(want) was used — the actual content was
   never compared. Fixed to assert len(got)==1 && got[0]=="", which
   validates the correct split behavior for an empty string.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Molecule AI · core-be 2026-05-13 07:27:21 +00:00
parent 0b0bb0adde
commit 409a2ecb93
2 changed files with 7 additions and 3 deletions

View File

@ -45,9 +45,9 @@ func TestSplitLines_TrailingNewline(t *testing.T) {
func TestSplitLines_Empty(t *testing.T) {
got := splitLines("")
want := []string{""}
if len(got) != len(want) {
t.Errorf("empty string should produce one empty-string element; got %v", got)
// An empty string should return a single-element slice containing ""
if len(got) != 1 || got[0] != "" {
t.Errorf("empty string should produce one empty-string element; got %v (len=%d)", got, len(got))
}
}

View File

@ -50,6 +50,10 @@ func TestNewHub_WithAccessChecker(t *testing.T) {
if h.canCommunicate("ws-1", "ws-2") {
t.Error("canCommunicate should return false for different IDs")
}
// Verify the checker was invoked at least once
if !called {
t.Error("access checker was not called")
}
}
// ---------- safeSend ----------