Skip to content

test: add unit tests for agent hooks and page components (#875)#901

Merged
Aureliolo merged 3 commits intomainfrom
test/agent-hooks-tests
Mar 28, 2026
Merged

test: add unit tests for agent hooks and page components (#875)#901
Aureliolo merged 3 commits intomainfrom
test/agent-hooks-tests

Conversation

@Aureliolo
Copy link
Copy Markdown
Owner

Summary

  • Add 49 tests across 7 new test files covering agent data hooks (useAgentsData, useAgentDetailData) and page/sub-components (AgentsPage, AgentDetailPage, ActivityLog, AgentGridView, AgentFilters)
  • Follow established patterns from useDashboardData.test.ts and DashboardPage.test.tsx
  • Add 3 factory helpers (makeActivityEvent, makeCareerEvent, makePerformanceSummary) to shared test factories

Test plan

  • All 49 tests pass with npm --prefix web run test
  • ESLint passes with zero warnings
  • Pre-reviewed by 4 agents (docs-consistency, test-quality, frontend-reviewer, issue-resolution-verifier), 3 findings addressed

Closes #875

🤖 Generated with Claude Code

Aureliolo and others added 2 commits March 28, 2026 16:00
Add 46 tests across 7 new test files covering the agent data hooks
(useAgentsData, useAgentDetailData) and page/sub-components
(AgentsPage, AgentDetailPage, ActivityLog, AgentGridView, AgentFilters).
Follows established patterns from useDashboardData.test.ts and
DashboardPage.test.tsx. Also adds 3 factory helpers (makeActivityEvent,
makeCareerEvent, makePerformanceSummary) to the shared test factories.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…le queries

Add performanceCards/insights derived data wiring tests, wsSetupError
test for detail page, and use getByRole('link') instead of closest('a')
in AgentGridView. Pre-reviewed by 4 agents, 3 findings addressed.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 28, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: bce71ab5-af4e-461f-b428-31da4c3446f2

📥 Commits

Reviewing files that changed from the base of the PR and between 57ed74e and e6c4c64.

📒 Files selected for processing (4)
  • web/src/__tests__/hooks/useAgentDetailData.test.ts
  • web/src/__tests__/hooks/useAgentsData.test.ts
  • web/src/__tests__/pages/AgentDetailPage.test.tsx
  • web/src/__tests__/pages/AgentsPage.test.tsx
📜 Recent review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: Dashboard Test
  • GitHub Check: Build Backend
  • GitHub Check: Build Web
  • GitHub Check: Build Sandbox
  • GitHub Check: Dependency Review
  • GitHub Check: Analyze (python)
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{ts,tsx}: Prefer interface for defining object shapes in TypeScript
Use camelCase for variable names and function identifiers

Files:

  • web/src/__tests__/hooks/useAgentsData.test.ts
  • web/src/__tests__/pages/AgentsPage.test.tsx
  • web/src/__tests__/hooks/useAgentDetailData.test.ts
  • web/src/__tests__/pages/AgentDetailPage.test.tsx
**/*.{py,ts,tsx,go}

📄 CodeRabbit inference engine (CLAUDE.md)

Lines must not exceed 88 characters (enforced by ruff for Python, configured in web/.eslintrc for TypeScript)

Files:

  • web/src/__tests__/hooks/useAgentsData.test.ts
  • web/src/__tests__/pages/AgentsPage.test.tsx
  • web/src/__tests__/hooks/useAgentDetailData.test.ts
  • web/src/__tests__/pages/AgentDetailPage.test.tsx
web/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Import cn from @/lib/utils for conditional class merging in components

Files:

  • web/src/__tests__/hooks/useAgentsData.test.ts
  • web/src/__tests__/pages/AgentsPage.test.tsx
  • web/src/__tests__/hooks/useAgentDetailData.test.ts
  • web/src/__tests__/pages/AgentDetailPage.test.tsx
web/src/**/*.tsx

📄 CodeRabbit inference engine (CLAUDE.md)

web/src/**/*.tsx: ALWAYS reuse existing shared components from web/src/components/ui/ before creating new ones (e.g., StatusBadge, MetricCard, AgentCard, DeptHealthBar, SectionCard)
Use Tailwind semantic classes (text-foreground, bg-card, text-accent, text-success) or CSS variables (var(--so-accent)); NEVER hardcode hex values or rgba() in .tsx files
Use font-sans or font-mono for typography (maps to Geist tokens); NEVER set fontFamily directly in CSS
Use density-aware spacing tokens (p-card, gap-section-gap, gap-grid-gap) or standard Tailwind spacing; NEVER hardcode pixel values for layout spacing
Do NOT recreate complex (>8 line) JSX inside .map() blocks; extract to a shared component in web/src/components/ui/

Files:

  • web/src/__tests__/pages/AgentsPage.test.tsx
  • web/src/__tests__/pages/AgentDetailPage.test.tsx
🧠 Learnings (7)
📓 Common learnings
Learnt from: CR
Repo: Aureliolo/synthorg PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-03-28T14:27:45.937Z
Learning: When review agents find valid issues (including pre-existing issues in surrounding code, suggestions, and findings adjacent to the PR's changes), fix them all — no deferring, no 'out of scope' skipping
📚 Learning: 2026-03-20T08:28:32.845Z
Learnt from: CR
Repo: Aureliolo/synthorg PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-03-20T08:28:32.845Z
Learning: Applies to web/src/__tests__/**/*.{ts,js} : Dashboard testing: Vitest unit tests organized by feature under `web/src/__tests__/`. Use fast-check for property-based testing (`fc.assert` + `fc.property`).

Applied to files:

  • web/src/__tests__/hooks/useAgentsData.test.ts
  • web/src/__tests__/pages/AgentsPage.test.tsx
  • web/src/__tests__/hooks/useAgentDetailData.test.ts
  • web/src/__tests__/pages/AgentDetailPage.test.tsx
📚 Learning: 2026-03-28T14:27:45.936Z
Learnt from: CR
Repo: Aureliolo/synthorg PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-03-28T14:27:45.936Z
Learning: Applies to **/*.{py,ts,tsx,go} : Lines must not exceed 88 characters (enforced by ruff for Python, configured in web/.eslintrc for TypeScript)

Applied to files:

  • web/src/__tests__/pages/AgentsPage.test.tsx
  • web/src/__tests__/pages/AgentDetailPage.test.tsx
📚 Learning: 2026-03-21T11:08:01.542Z
Learnt from: CR
Repo: Aureliolo/synthorg PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-03-21T11:08:01.542Z
Learning: Applies to **/*.{py,md} : Line length: 88 characters (ruff).

Applied to files:

  • web/src/__tests__/pages/AgentsPage.test.tsx
📚 Learning: 2026-03-28T14:27:45.936Z
Learnt from: CR
Repo: Aureliolo/synthorg PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-03-28T14:27:45.936Z
Learning: Applies to web/src/**/*.tsx : Do NOT recreate complex (>8 line) JSX inside `.map()` blocks; extract to a shared component in `web/src/components/ui/`

Applied to files:

  • web/src/__tests__/pages/AgentsPage.test.tsx
  • web/src/__tests__/pages/AgentDetailPage.test.tsx
📚 Learning: 2026-03-28T14:27:45.936Z
Learnt from: CR
Repo: Aureliolo/synthorg PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-03-28T14:27:45.936Z
Learning: Applies to **/*.{ts,tsx} : Prefer `interface` for defining object shapes in TypeScript

Applied to files:

  • web/src/__tests__/pages/AgentDetailPage.test.tsx
📚 Learning: 2026-03-28T14:27:45.936Z
Learnt from: CR
Repo: Aureliolo/synthorg PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-03-28T14:27:45.936Z
Learning: Applies to web/src/components/ui/**/*.tsx : Export component props as a TypeScript interface

Applied to files:

  • web/src/__tests__/pages/AgentDetailPage.test.tsx
🔇 Additional comments (7)
web/src/__tests__/hooks/useAgentsData.test.ts (1)

1-131: Well-structured hook tests following established patterns.

The test suite comprehensively covers:

  • Lifecycle (fetch on mount, polling start)
  • State propagation (loading, agents, error from store)
  • WebSocket bindings and connection states
  • Filter behavior with derived filteredAgents

The mocking approach using vi.hoisted() for polling mocks and dynamic imports for WebSocket state overrides is clean and maintainable.

web/src/__tests__/hooks/useAgentDetailData.test.ts (1)

1-178: Comprehensive hook lifecycle and derived data testing.

Excellent coverage including:

  • Mount/unmount lifecycle with clearDetail cleanup verification
  • Empty agentName edge cases (no fetch, no polling, empty bindings)
  • Offset calculation for fetchMoreActivity pagination
  • Derived data validation (performanceCards labels, insights content)

The test at lines 118-125 correctly validates that fetchMoreActivity uses activity.length as the offset, which is critical for pagination correctness.

web/src/__tests__/pages/AgentsPage.test.tsx (2)

7-15: Component mocks correctly intercept relative imports.

The mocks at @/pages/agents/* correctly intercept the relative imports in AgentsPage.tsx (e.g., ./agents/AgentsSkeleton) because both resolve to the same module path when the page is at @/pages/AgentsPage.


47-115: Test suite covers critical UI states effectively.

Good coverage of:

  • Loading states (skeleton shown/hidden based on data presence)
  • Error rendering with role-based query (getByRole('alert'))
  • WebSocket connection status indicators
  • Conditional warning suppression during loading

The pattern of resetting hookReturn in beforeEach ensures test isolation.

web/src/__tests__/pages/AgentDetailPage.test.tsx (3)

10-17: Good use of interface for mock prop typing.

The MockAgentProp interface follows the TypeScript style guideline for defining object shapes, keeping the mock component signature clean and type-safe.


65-73: Parameterized route setup correctly enables useParams integration.

Using Routes/Route with MemoryRouter's initialEntries ensures useParams() in AgentDetailPage extracts the agentName parameter correctly. This is the proper pattern for testing route-param-dependent components.


75-143: Test suite thoroughly covers page rendering states.

Strong coverage of:

  • Loading skeleton vs. not-found messaging based on agent presence
  • Error propagation with and without agent data
  • WebSocket status indicators with custom error messages
  • Component rendering verification via data-testid

The beforeEach correctly resets fetchMoreActivity to a fresh vi.fn() to avoid cross-test contamination.


Walkthrough

Adds three test factory functions (makeActivityEvent, makeCareerEvent, makePerformanceSummary) to test helpers and introduces multiple new unit test files: hook tests for useAgentsData and useAgentDetailData; page tests for AgentsPage and AgentDetailPage; and component tests for ActivityLog, AgentFilters, and AgentGridView. Tests mock WebSocket and polling hooks, reset and control store state, and cover lifecycle behavior, rendering states, user interactions, and data-derived outputs.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 40.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely summarizes the main change: adding unit tests for agent hooks and page components.
Description check ✅ Passed The description clearly relates to the changeset, detailing the 49 tests added across 7 files, factory helpers, testing patterns followed, and verification that all tests pass.
Linked Issues check ✅ Passed All critical and important objectives from issue #875 are met: 4 critical test files created following patterns, 3 important test files created, factory helpers added, and all tests verified to pass.
Out of Scope Changes check ✅ Passed All changes are in-scope: new test files, factory helper additions, and no modifications to production code. Changes directly address requirements in issue #875.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a comprehensive testing suite for the agents module, including unit tests for the useAgentsData and useAgentDetailData hooks, and integration tests for the AgentsPage, AgentDetailPage, and associated sub-components. It also expands the test factories with new helper functions for activity and career events. Feedback focuses on improving test robustness by replacing hardcoded timestamps in factories with dynamic values to support ordering scenarios and expanding hook tests to cover disconnected WebSocket states.

Comment on lines +147 to +155
export function makeActivityEvent(overrides?: Partial<AgentActivityEvent>): AgentActivityEvent {
return {
event_type: 'task_completed',
timestamp: '2026-03-25T12:00:00Z',
description: 'Completed task task-1',
related_ids: {},
...overrides,
}
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The makeActivityEvent factory uses a hardcoded timestamp. This can make it difficult to test scenarios that rely on event ordering. Consider using a sequence or a function to generate unique timestamps for each created event. This would make the factory more robust and useful for a wider range of test cases, such as testing sorting logic.

Comment on lines +157 to +165
export function makeCareerEvent(overrides?: Partial<CareerEvent>): CareerEvent {
return {
event_type: 'hired',
timestamp: '2026-03-01T00:00:00Z',
description: 'Hired as Developer',
initiated_by: 'system',
metadata: {},
...overrides,
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Similar to makeActivityEvent, this factory uses a hardcoded timestamp. For better test data generation and to support testing scenarios involving ordering, consider generating unique timestamps for each event.

Comment on lines +126 to +129
it('returns wsConnected from useWebSocket', () => {
const { result } = renderHook(() => useAgentDetailData('alice'))
expect(result.current.wsConnected).toBe(true)
})
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This test verifies that wsConnected is true, but it's testing a hardcoded value from the mock rather than the hook's ability to handle different connection states. To improve test coverage, consider adding a test case where useWebSocket returns { connected: false } to ensure the hook correctly propagates this state.

Comment on lines +85 to +88
it('returns wsConnected from useWebSocket', () => {
const { result } = renderHook(() => useAgentsData())
expect(result.current.wsConnected).toBe(true)
})
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This test only verifies the hardcoded true value from the useWebSocket mock. To make the test more robust, it would be beneficial to add a test case where useWebSocket returns { connected: false } to confirm the hook correctly handles and returns different connection statuses.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 28, 2026

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Snapshot Warnings

⚠️: No snapshots were found for the head SHA e6c4c64.
Ensure that dependencies are being submitted on PR branches. Re-running this action after a short time may resolve the issue. See the documentation for more information and troubleshooting advice.

Scanned Files

None

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@web/src/__tests__/pages/AgentDetailPage.test.tsx`:
- Around line 11-13: Replace the inline type literal for the AgentIdentityHeader
prop with a named interface: declare an interface (e.g., Agent or
AgentIdentityProps) that defines the shape { name: string } and update the
AgentIdentityHeader signature to use that interface (AgentIdentityHeader: ({
agent }: { agent: Agent }) => ... or AgentIdentityHeader: ({ agent }:
AgentIdentityProps) => ...), ensuring the test imports/declares the interface
near the mock component so it follows the project's "prefer interface" rule.
- Line 109: The line assigning hookReturn with {...defaultHookReturn,
wsConnected: false, wsSetupError: 'WebSocket auth failed'} is over 88 chars;
break the object literal across multiple lines so keys are each on their own
line (e.g., set hookReturn = { ...defaultHookReturn, wsConnected: false,
wsSetupError: 'WebSocket auth failed' } across several lines) to keep the
assignment within the 88-character limit and preserve the same properties (refer
to hookReturn, defaultHookReturn, wsConnected, wsSetupError).

In `@web/src/__tests__/pages/AgentsPage.test.tsx`:
- Line 58: The object literal assigned to hookReturn (spread of
defaultHookReturn with loading, totalAgents, agents, filteredAgents) is too
long; reformat it to multiple lines to satisfy the 88-character limit (e.g.,
place each property on its own line after the spread) and apply the same
wrapping to the similar object at the other occurrence so both lines (the ones
around hookReturn and the one at line ~89) conform to the max line length while
keeping the same property order and values.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 13d51a97-1aec-4558-a797-2105dd773a05

📥 Commits

Reviewing files that changed from the base of the PR and between 937974e and 57ed74e.

📒 Files selected for processing (8)
  • web/src/__tests__/helpers/factories.ts
  • web/src/__tests__/hooks/useAgentDetailData.test.ts
  • web/src/__tests__/hooks/useAgentsData.test.ts
  • web/src/__tests__/pages/AgentDetailPage.test.tsx
  • web/src/__tests__/pages/AgentsPage.test.tsx
  • web/src/__tests__/pages/agents/ActivityLog.test.tsx
  • web/src/__tests__/pages/agents/AgentFilters.test.tsx
  • web/src/__tests__/pages/agents/AgentGridView.test.tsx
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: Build Web
  • GitHub Check: Build Sandbox
  • GitHub Check: Build Backend
  • GitHub Check: Dashboard Test
  • GitHub Check: Dependency Review
  • GitHub Check: Analyze (python)
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{ts,tsx}: Prefer interface for defining object shapes in TypeScript
Use camelCase for variable names and function identifiers

Files:

  • web/src/__tests__/pages/agents/AgentGridView.test.tsx
  • web/src/__tests__/pages/agents/AgentFilters.test.tsx
  • web/src/__tests__/pages/AgentsPage.test.tsx
  • web/src/__tests__/hooks/useAgentsData.test.ts
  • web/src/__tests__/pages/agents/ActivityLog.test.tsx
  • web/src/__tests__/pages/AgentDetailPage.test.tsx
  • web/src/__tests__/helpers/factories.ts
  • web/src/__tests__/hooks/useAgentDetailData.test.ts
web/src/**/*.tsx

📄 CodeRabbit inference engine (CLAUDE.md)

web/src/**/*.tsx: ALWAYS reuse existing shared components from web/src/components/ui/ before creating new ones (e.g., StatusBadge, MetricCard, AgentCard, DeptHealthBar, SectionCard)
Use Tailwind semantic classes (text-foreground, bg-card, text-accent, text-success) or CSS variables (var(--so-accent)); NEVER hardcode hex values or rgba() in .tsx files
Use font-sans or font-mono for typography (maps to Geist tokens); NEVER set fontFamily directly in CSS
Use density-aware spacing tokens (p-card, gap-section-gap, gap-grid-gap) or standard Tailwind spacing; NEVER hardcode pixel values for layout spacing
Do NOT recreate complex (>8 line) JSX inside .map() blocks; extract to a shared component in web/src/components/ui/

Files:

  • web/src/__tests__/pages/agents/AgentGridView.test.tsx
  • web/src/__tests__/pages/agents/AgentFilters.test.tsx
  • web/src/__tests__/pages/AgentsPage.test.tsx
  • web/src/__tests__/pages/agents/ActivityLog.test.tsx
  • web/src/__tests__/pages/AgentDetailPage.test.tsx
**/*.{py,ts,tsx,go}

📄 CodeRabbit inference engine (CLAUDE.md)

Lines must not exceed 88 characters (enforced by ruff for Python, configured in web/.eslintrc for TypeScript)

Files:

  • web/src/__tests__/pages/agents/AgentGridView.test.tsx
  • web/src/__tests__/pages/agents/AgentFilters.test.tsx
  • web/src/__tests__/pages/AgentsPage.test.tsx
  • web/src/__tests__/hooks/useAgentsData.test.ts
  • web/src/__tests__/pages/agents/ActivityLog.test.tsx
  • web/src/__tests__/pages/AgentDetailPage.test.tsx
  • web/src/__tests__/helpers/factories.ts
  • web/src/__tests__/hooks/useAgentDetailData.test.ts
web/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Import cn from @/lib/utils for conditional class merging in components

Files:

  • web/src/__tests__/pages/agents/AgentGridView.test.tsx
  • web/src/__tests__/pages/agents/AgentFilters.test.tsx
  • web/src/__tests__/pages/AgentsPage.test.tsx
  • web/src/__tests__/hooks/useAgentsData.test.ts
  • web/src/__tests__/pages/agents/ActivityLog.test.tsx
  • web/src/__tests__/pages/AgentDetailPage.test.tsx
  • web/src/__tests__/helpers/factories.ts
  • web/src/__tests__/hooks/useAgentDetailData.test.ts
🧠 Learnings (2)
📚 Learning: 2026-03-20T08:28:32.845Z
Learnt from: CR
Repo: Aureliolo/synthorg PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-03-20T08:28:32.845Z
Learning: Applies to web/src/__tests__/**/*.{ts,js} : Dashboard testing: Vitest unit tests organized by feature under `web/src/__tests__/`. Use fast-check for property-based testing (`fc.assert` + `fc.property`).

Applied to files:

  • web/src/__tests__/pages/agents/AgentGridView.test.tsx
  • web/src/__tests__/pages/agents/AgentFilters.test.tsx
  • web/src/__tests__/pages/AgentsPage.test.tsx
  • web/src/__tests__/hooks/useAgentsData.test.ts
  • web/src/__tests__/pages/agents/ActivityLog.test.tsx
  • web/src/__tests__/pages/AgentDetailPage.test.tsx
  • web/src/__tests__/helpers/factories.ts
  • web/src/__tests__/hooks/useAgentDetailData.test.ts
📚 Learning: 2026-03-28T14:27:45.936Z
Learnt from: CR
Repo: Aureliolo/synthorg PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-03-28T14:27:45.936Z
Learning: Applies to web/src/components/ui/**/*.tsx : New shared components must have a corresponding `.stories.tsx` Storybook file with all component states (default, hover, loading, error, empty)

Applied to files:

  • web/src/__tests__/pages/agents/AgentGridView.test.tsx
  • web/src/__tests__/pages/agents/AgentFilters.test.tsx
  • web/src/__tests__/pages/AgentsPage.test.tsx
  • web/src/__tests__/pages/agents/ActivityLog.test.tsx
🔇 Additional comments (7)
web/src/__tests__/helpers/factories.ts (1)

147-187: Good factory additions for reusable agent test data.

These helpers are complete, strongly typed, and keep override ergonomics consistent with the existing test factory pattern.

web/src/__tests__/pages/agents/AgentGridView.test.tsx (1)

24-29: Nice coverage for encoded route links.

Validating the encoded href via getByRole('link') is the right assertion surface here.

web/src/__tests__/pages/agents/AgentFilters.test.tsx (1)

54-62: Empty-to-null mapping test is well targeted.

This directly verifies the contract between the select control and store action.

web/src/__tests__/pages/agents/ActivityLog.test.tsx (1)

23-41: Load-more behavior coverage is solid.

You covered both visibility boundaries and the click side-effect clearly.

web/src/__tests__/hooks/useAgentsData.test.ts (1)

76-83: WebSocket binding assertion is precise and useful.

Validating the exact channel set (['agents']) gives good regression protection.

web/src/__tests__/pages/AgentsPage.test.tsx (1)

82-92: Good WS warning-state coverage at page level.

Testing both disconnected state and custom wsSetupError message is a strong addition.

web/src/__tests__/hooks/useAgentDetailData.test.ts (1)

117-124: Great validation of derived state and pagination offset behavior.

The activity.length offset assertion plus performanceCards/insights checks provide good regression protection.

Also applies to: 131-147

…abbit

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@Aureliolo Aureliolo merged commit 1d81546 into main Mar 28, 2026
29 checks passed
@Aureliolo Aureliolo deleted the test/agent-hooks-tests branch March 28, 2026 15:37
Aureliolo added a commit that referenced this pull request Mar 30, 2026
🤖 I have created a release *beep* *boop*
---
#MAJOR CHANGES; We got a somewhat working webui :)

##
[0.5.0](v0.4.9...v0.5.0)
(2026-03-30)


### Features

* add analytics trends and budget forecast API endpoints
([#798](#798))
([16b61f5](16b61f5))
* add department policies to default templates
([#852](#852))
([7a41548](7a41548))
* add remaining activity event types (task_started, tool_used,
delegation, cost_incurred)
([#832](#832))
([4252fac](4252fac))
* agent performance, activity, and history API endpoints
([#811](#811))
([9b75c1d](9b75c1d))
* Agent Profiles and Detail pages (biography, career, performance)
([#874](#874))
([62d7880](62d7880))
* app shell, Storybook, and CI/CD pipeline
([#819](#819))
([d4dde90](d4dde90))
* Approvals page with risk grouping, urgency indicators, batch actions
([#889](#889))
([4e9673d](4e9673d))
* Budget Panel page (P&L dashboard, breakdown charts, forecast)
([#890](#890))
([b63b0f1](b63b0f1))
* build infrastructure layer (API client, auth, WebSocket)
([#815](#815))
([9f01d3e](9f01d3e))
* CLI global options infrastructure, UI modes, exit codes, env vars
([#891](#891))
([fef4fc5](fef4fc5))
* CodeMirror editor and theme preferences toggle
([#905](#905),
[#807](#807))
([#909](#909))
([41fbedc](41fbedc))
* Company page (department/agent management)
([#888](#888))
([cfb88b0](cfb88b0))
* comprehensive hint coverage across all CLI commands
([#900](#900))
([937974e](937974e))
* config system extensions, per-command flags for
init/start/stop/status/logs
([#895](#895))
([32f83fe](32f83fe))
* configurable currency system replacing hardcoded USD
([#854](#854))
([b372551](b372551))
* Dashboard page (metric cards, activity feed, budget burn)
([#861](#861))
([7d519d5](7d519d5))
* department health, provider status, and activity feed endpoints
([#818](#818))
([6d5f196](6d5f196))
* design tokens and core UI components
([#833](#833))
([ed887f2](ed887f2))
* extend approval, meeting, and budget API responses
([#834](#834))
([31472bf](31472bf))
* frontend polish -- real-time UX, accessibility, responsive,
performance ([#790](#790),
[#792](#792),
[#791](#791),
[#793](#793))
([#917](#917))
([f04a537](f04a537))
* implement human roles and access control levels
([#856](#856))
([d6d8a06](d6d8a06))
* implement semantic conflict detection in workspace merge
([#860](#860))
([d97283b](d97283b))
* interaction components and animation patterns
([#853](#853))
([82d4b01](82d4b01))
* Login page + first-run bootstrap + Company page
([#789](#789),
[#888](#888))
([#896](#896))
([8758e8d](8758e8d))
* Meetings page with timeline viz, token bars, contribution formatting
([#788](#788))
([#904](#904))
([b207f46](b207f46))
* Messages page with threading, channel badges, sender indicators
([#787](#787))
([#903](#903))
([28293ad](28293ad))
* Org Chart force-directed view and drag-drop reassignment
([#872](#872),
[#873](#873))
([#912](#912))
([a68a938](a68a938))
* Org Chart page (living nodes, status, CRUD, department health)
([#870](#870))
([0acbdae](0acbdae))
* per-command flags for remaining commands, auto-behavior wiring,
help/discoverability
([#897](#897))
([3f7afa2](3f7afa2))
* Providers page with backend rework -- health, CRUD, subscription auth
([#893](#893))
([9f8dd98](9f8dd98))
* scaffold React + Vite + TypeScript + Tailwind project
([#799](#799))
([bd151aa](bd151aa))
* Settings page with search, dependency indicators, grouped rendering
([#784](#784))
([#902](#902))
([a7b9870](a7b9870))
* Setup Wizard rebuild with template comparison, cost estimator, theme
customization ([#879](#879))
([ae8b50b](ae8b50b))
* setup wizard UX -- template filters, card metadata, provider form
reuse ([#910](#910))
([7f04676](7f04676))
* setup wizard UX overhaul -- mode choice, step reorder, provider fixes
([#907](#907))
([ee964c4](ee964c4))
* structured ModelRequirement in template agent configs
([#795](#795))
([7433548](7433548))
* Task Board page (rich Kanban, filtering, dependency viz)
([#871](#871))
([04a19b0](04a19b0))


### Bug Fixes

* align frontend types with backend and debounce WS refetches
([#916](#916))
([134c11b](134c11b))
* auto-cleanup targets newly pulled images instead of old ones
([#884](#884))
([50e6591](50e6591))
* correct wipe backup-skip flow and harden error handling
([#808](#808))
([c05860f](c05860f))
* improve provider setup in wizard, subscription auth, dashboard bugs
([#914](#914))
([87bf8e6](87bf8e6))
* improve update channel detection and add config get command
([#814](#814))
([6b137f0](6b137f0))
* resolve all ESLint warnings, add zero-warnings enforcement
([#899](#899))
([079b46a](079b46a))
* subscription auth uses api_key, base URL optional for cloud providers
([#915](#915))
([f0098dd](f0098dd))


### Refactoring

* semantic analyzer cleanup -- shared filtering, concurrency, extraction
([#908](#908))
([81372bf](81372bf))


### Documentation

* brand identity and UX design system from
[#765](#765) exploration
([#804](#804))
([389a9f4](389a9f4))
* page structure and information architecture for v0.5.0 dashboard
([#809](#809))
([f8d6d4a](f8d6d4a))
* write UX design guidelines with WCAG-verified color system
([#816](#816))
([4a4594e](4a4594e))


### Tests

* add unit tests for agent hooks and page components
([#875](#875))
([#901](#901))
([1d81546](1d81546))


### CI/CD

* bump actions/deploy-pages from 4.0.5 to 5.0.0 in the major group
([#831](#831))
([01c19de](01c19de))
* bump astral-sh/setup-uv from 7.6.0 to 8.0.0 in
/.github/actions/setup-python-uv in the all group
([#920](#920))
([5f6ba54](5f6ba54))
* bump codecov/codecov-action from 5.5.3 to 6.0.0 in the major group
([#868](#868))
([f22a181](f22a181))
* bump github/codeql-action from 4.34.1 to 4.35.0 in the all group
([#883](#883))
([87a4890](87a4890))
* bump sigstore/cosign-installer from 4.1.0 to 4.1.1 in the
minor-and-patch group
([#830](#830))
([7a69050](7a69050))
* bump the all group with 3 updates
([#923](#923))
([ff27c8e](ff27c8e))
* bump wrangler from 4.76.0 to 4.77.0 in /.github in the minor-and-patch
group ([#822](#822))
([07d43eb](07d43eb))
* bump wrangler from 4.77.0 to 4.78.0 in /.github in the all group
([#882](#882))
([f84118d](f84118d))


### Maintenance

* add design system enforcement hook and component inventory
([#846](#846))
([15abc43](15abc43))
* add dev-only auth bypass for frontend testing
([#885](#885))
([6cdcd8a](6cdcd8a))
* add pre-push rebase check hook
([#855](#855))
([b637a04](b637a04))
* backend hardening -- eviction/size-caps and model validation
([#911](#911))
([81253d9](81253d9))
* bump axios from 1.13.6 to 1.14.0 in /web in the all group across 1
directory ([#922](#922))
([b1b0232](b1b0232))
* bump brace-expansion from 5.0.4 to 5.0.5 in /web
([#862](#862))
([ba4a565](ba4a565))
* bump eslint-plugin-react-refresh from 0.4.26 to 0.5.2 in /web
([#801](#801))
([7574bb5](7574bb5))
* bump faker from 40.11.0 to 40.11.1 in the minor-and-patch group
([#803](#803))
([14d322e](14d322e))
* bump https://github.com/astral-sh/ruff-pre-commit from v0.15.7 to
0.15.8 ([#864](#864))
([f52901e](f52901e))
* bump nginxinc/nginx-unprivileged from `6582a34` to `f99cc61` in
/docker/web in the all group
([#919](#919))
([df85e4f](df85e4f))
* bump nginxinc/nginx-unprivileged from `ccbac1a` to `6582a34` in
/docker/web ([#800](#800))
([f4e9450](f4e9450))
* bump node from `44bcbf4` to `71be405` in /docker/sandbox
([#827](#827))
([91bec67](91bec67))
* bump node from `5209bca` to `cf38e1f` in /docker/web
([#863](#863))
([66d6043](66d6043))
* bump picomatch in /site
([#842](#842))
([5f20bcc](5f20bcc))
* bump recharts 2-&gt;3 and @types/node 22-&gt;25 in /web
([#802](#802))
([a908800](a908800))
* Bump requests from 2.32.5 to 2.33.0
([#843](#843))
([41daf69](41daf69))
* bump smol-toml from 1.6.0 to 1.6.1 in /site
([#826](#826))
([3e5dbe4](3e5dbe4))
* bump the all group with 3 updates
([#921](#921))
([7bace0b](7bace0b))
* bump the minor-and-patch group across 1 directory with 2 updates
([#829](#829))
([93e611f](93e611f))
* bump the minor-and-patch group across 1 directory with 3 updates
([#841](#841))
([7010c8e](7010c8e))
* bump the minor-and-patch group across 1 directory with 3 updates
([#869](#869))
([548cee5](548cee5))
* bump the minor-and-patch group in /site with 2 updates
([#865](#865))
([9558101](9558101))
* bump the minor-and-patch group with 2 updates
([#867](#867))
([4830706](4830706))
* consolidate Dependabot groups to 1 PR per ecosystem
([06d2556](06d2556))
* consolidate Dependabot groups to 1 PR per ecosystem
([#881](#881))
([06d2556](06d2556))
* improve worktree skill with full dep sync and status enhancements
([#906](#906))
([772c625](772c625))
* remove Vue remnants and document framework decision
([#851](#851))
([bf2adf6](bf2adf6))
* update web dependencies and fix brace-expansion CVE
([#880](#880))
([a7a0ed6](a7a0ed6))
* upgrade to Storybook 10 and TypeScript 6
([#845](#845))
([52d95f2](52d95f2))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test: add unit tests for agent hooks and page components

1 participant