Skip to content

test(agent): pin the connect-app nudge card - ConnectAppCard (Closes #1582) - #2029

Merged
dmitrii-f-t27 merged 1 commit into
queenfrom
zcode-mbp/tests-1582-connect-app-card
Oct 15, 2026
Merged

dmitrii-f-t27 merged 1 commit into
queenfrom
zcode-mbp/tests-1582-connect-app-card

Conversation

@dmitrii-f-t27

Copy link
Copy Markdown
Collaborator

Closes #1582

What

The first suite for apps/agent/entrypoints/sidepanel/index/ConnectAppCard.tsx (ConnectAppCard, the only export), under bun test in the agent group.

  • describe block: ConnectAppCardTsxContract (appears nowhere else in the tree).
  • The card dispatches on its position - a last-message nudge opens the choosing card, anything earlier resolves on the spot. The seams are stubbed in the forms this group already carries: the chat-session context, the MCP store in its live-proxy module form, the managed-server and api-key mutations idle, the declined-apps item (WXT #imports virtual module) a plain stand-in, the metrics track a no-op - the api-key dialog the choosing card mounts stays real, closed as it first renders.
  • Pin: the choosing card answers the connect heading with its reason, the connect button naming the app and the manual button; the resolved card answers the suggested note with the app's name. The oauth round trip, the api-key submission, the manual decline and the completion messages live in handlers needing a live document - per User Story 2.
  • FR-004 shown both ways, quoted: broken subject (the connect heading reworded) β†’ 0 pass / 1 fail; restored β†’ 1 pass / 0 fail / 6 expect(). git diff --name-only lists only the new test file.

Local gates

  • Suite: 1 pass / 0 fail (6 expect()); grep -c 'it(' = 1; 1 + 0 blocked = 1.
  • Group (apps/agent): 404 pass / 3 fail / 407 tests β€” the 3 = the pre-existing port-helper noise, unchanged from baseline.
  • Biome: 0. Typecheck: 0 errors / 0 mentions.

No database, no container, no network.

@tri-claw

tri-claw Bot commented Oct 15, 2026

Copy link
Copy Markdown

Summary by t27-bees

This PR adds a contract test for ConnectAppCard.tsx that pins the current rendering behavior of the connect-app nudge card. The test verifies the card shows the correct heading, reason, and buttons when rendered as a last-message nudge versus an earlier nudge, using stubbed dependencies.

Worth a look

  • trios/agent-server/apps/agent/entrypoints/sidepanel/index/ConnectAppCard.test.ts:53-65 β€” The mcpServerStorage mock imports @wxt-dev/storage at call time inside async functions. If that module isn't available or behaves differently in the test environment (e.g., missing defineItem), these mocks will throw at runtime rather than at import time, making failures harder to trace.

  • trios/agent-server/apps/agent/entrypoints/sidepanel/index/ConnectAppCard.test.ts:105 β€” The subject is imported via a query-qualified URL (./ConnectAppCard?connect-app-card-suite-real) to force a fresh module instance. This non-standard pattern relies on the bundler/test runner treating each queried URL as a separate entry point; if the tooling ever dedupes by path ignoring the query, the test could share state with other suites unexpectedly.

  • trios/agent-server/apps/agent/entrypoints/sidepanel/index/ConnectAppCard.test.ts:115 β€” renderToStaticMarkup produces plain HTML without React internals (no data-reactroot, no event handlers). The test therefore cannot catch missing onClick props, broken button wiring, or client-side hydration mismatches β€” it only asserts on text content.

  • trios/agent-server/apps/agent/entrypoints/sidepanel/index/ConnectAppCard.test.ts:121-126 β€” Assertions check for exact string matches (e.g., 'Connect Notion for better results', 'Track your docs'). Any copy change β€” including whitespace or punctuation β€” will fail the suite even if the component's contract (heading, reason, connect button, manual button) is intact.

  • trios/agent-server/apps/agent/entrypoints/sidepanel/index/ConnectAppCard.test.ts:87-94 β€” The useAddManagedServer mock returns { oauthUrl: null, apiKeyUrl: null } unconditionally. If the real hook ever returns a truthy oauthUrl or apiKeyUrl for Notion, the component may render an OAuth flow or API-key dialog that this test doesn't exercise, creating a silent coverage gap.


Read: 1 files, +131 -0, the whole diff. Head 5465fd7. Model: openai-compatible/nvidia/nemotron-3-ultra-550b-a55b. Commands: @t27-bees review | summary | help | pause | resume. Free for every repository.

@github-actions

Copy link
Copy Markdown

βœ… Tests passed β€” 3816/3886

Suite Passed Failed Skipped
βœ… agent 414/414 0 0
βœ… build 9/9 0 0
βœ… cdp-protocol 5/5 0 0
βœ… eval 93/93 0 0
βœ… server-agent 280/280 0 0
βœ… server-api 2189/2258 0 69
βœ… server-browser 6/6 0 0
βœ… server-integration 10/11 0 1
βœ… server-lib 279/279 0 0
βœ… server-pglive 166/166 0 0
βœ… server-root 68/68 0 0
βœ… server-sim 8/8 0 0
βœ… server-skills 31/31 0 0
βœ… server-tools 244/244 0 0
βœ… shared 14/14 0 0

View workflow run

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.

1 participant