Files
vercel__chat/packages/integration-tests
Ben Sabic 4717a38407 feat(slack): support data table and data visualization blocks (#696)
Adds support for Slack's [data
table](https://docs.slack.dev/reference/block-kit/blocks/data-table-block)
and [data
visualization](https://docs.slack.dev/reference/block-kit/blocks/data-visualization-block)
Block Kit blocks.

- **`chat`**: new cross-platform `ChartElement` + `Chart()` builder (JSX
supported) mirroring Slack's model — pie `segments`, or bar/area/line
`series` against shared `categories`. `Table()` gains optional `caption`
and `pageSize`. Charts degrade to a text table on other platforms via
the shared card fallback (`chartElementToFallbackText`).
- **`@chat-adapter/slack`**: card tables now render as paginated,
sortable `data_table` blocks by default (header-only tables keep the
plain `table` block; oversized tables still fall back to ASCII). Charts
render as `data_visualization` blocks; charts violating Slack
constraints — including the undocumented **max 2 charts per message** —
fall back to a text rendering instead of an API rejection. Same
treatment in the `@chat-adapter/slack/blocks` subpath.
- **`postMessage`** now surfaces Slack's per-block validation messages
on `invalid_blocks` errors (this is how the 2-chart limit was found).
- Example app gets a **Show Charts** button and table pagination on
**Show Table**; docs, feature matrices, and changeset updated.

Verified live against Slack: data table pagination/sorting and both
chart types render natively.

<table>
  <tr>
    <th>Data Table</th>
    <th>Data Charts</th>
  </tr>
  <tr>
<td><img width="979" height="896" alt="CleanShot 2026-07-12 at 23 28 32"
src="https://github.com/user-attachments/assets/3307bd90-9322-452f-86fb-07d46446822d"
/></td>
<td><img width="955" height="879" alt="CleanShot 2026-07-12 at 23 29 02"
src="https://github.com/user-attachments/assets/ddb31a1b-e3fd-457c-a2e6-bde4934afebe"
/></td>
  </tr>
</table>

---------

Co-authored-by: Ben Sabic <bensabic@users.noreply.github.com>
2026-07-13 07:57:40 +01:00
..
2025-12-31 16:10:32 -08:00
2026-02-27 09:58:28 -08:00

Integration Tests

Integration tests for the Chat SDK that verify real-world webhook payloads are handled correctly.

Test Categories

  • Unit tests (slack.test.ts, teams.test.ts, gchat.test.ts) - Test adapter functionality with mock payloads
  • Replay tests (replay*.test.ts) - Replay actual production webhook recordings
  • Emulator tests (src/emulator/<adapter>/*.test.ts) - Drive the SDK against an in-process Emulate.dev server, one per supported adapter (@emulators/slack, @emulators/github). Assertions read the emulator's stateful store (messages, comments, reactions, installations) instead of mock call records. Each adapter is wired in via its apiUrl config. Inbound deliveries: the Slack flow re-signs event_callback payloads with x-slack-signature via a small in-test forwarder before handing them to chat.webhooks.slack(...), while the GitHub flow is a near-passthrough because the emulator's WebhookDispatcher already signs with X-Hub-Signature-256 exactly as the adapter expects. Helpers live in src/emulator/slack/utils.ts and src/emulator/github/utils.ts.

Replay Tests

Replay tests use recorded webhook payloads from production to verify the SDK handles real interactions correctly.

See fixtures/replay/README.md for:

  • How to record new fixtures
  • Fixture format documentation
  • SHA-based recording workflow
  • Platform-specific webhook formats

Running Tests

# Run all integration tests
pnpm --filter @chat-adapter/integration-tests test

# Run with watch mode
pnpm --filter @chat-adapter/integration-tests test:watch