(t *testing.T)
| 89 | } |
| 90 | |
| 91 | func TestHandleAgentActivity_EmptyActivity(t *testing.T) { |
| 92 | ua, store, token := setupUserAuth(t) |
| 93 | ctx := context.Background() |
| 94 | |
| 95 | user, _ := store.GetUserSession(ctx, token) |
| 96 | store.ClaimOrCreateDomain(ctx, "empty-activity.example.com", user.ID) |
| 97 | store.CreateAgent(ctx, "agent@empty-activity.example.com", "empty-activity.example.com", "", "https://example.com/webhook", "", user.ID) |
| 98 | |
| 99 | req := authedRequest("GET", "/api/dashboard/agents/agent%40empty-activity.example.com/activity", token) |
| 100 | w := httptest.NewRecorder() |
| 101 | ua.HandleAgentActivity(w, req) |
| 102 | |
| 103 | if w.Code != http.StatusOK { |
| 104 | t.Fatalf("status = %d, want 200", w.Code) |
| 105 | } |
| 106 | |
| 107 | var activity []identity.Message |
| 108 | json.NewDecoder(w.Body).Decode(&activity) |
| 109 | if len(activity) != 0 { |
| 110 | t.Errorf("expected empty activity, got %d", len(activity)) |
| 111 | } |
| 112 | } |
| 113 | |
| 114 | func TestHandleAgentActivity_WithMessages(t *testing.T) { |
| 115 | ua, store, token := setupUserAuth(t) |
nothing calls this directly
no test coverage detected