Files
vercel__chat/packages/tests
github-actions[bot] a5b118f1dc chore(release): version packages (#546)
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## @chat-adapter/slack@4.30.0

### Minor Changes

-   4c46c26: add lightweight Slack formatting primitives subpath
- dbd8dc5: expose runtime-free Block Kit helpers for Slack card
conversion
-   aba6aa9: add lightweight Slack API primitives subpath
-   b332a03: add lightweight Slack webhook primitives subpath
- 6ed4a43: add low-level Slack helpers for files, thread replies, views,
interactions, and input blocks

### Patch Changes

- 9b8d8c4: expand npm `keywords` for adapter and state packages to
improve discoverability (adds `chat-sdk`, `chatbot`, `ai-agent`,
`ai-sdk`, `vercel`, plus platform-specific terms)

- 073ff92: surface Slack file upload confirmation ids in postMessage
results

-   b63c042: fix(slack): resolve reaction user display names

Slack reaction events now resolve the reacting user's display name and
real name
through the existing cached user lookup path. If lookup fails, the
adapter falls
    back to the Slack user ID.

-   1294490: reuse low-level Slack formatting helpers in the adapter

- 999d268: pass the Slack bot token through native stream append and
stop calls

-   Updated dependencies [5461ea9]
    -   chat@4.30.0
    -   @chat-adapter/shared@4.30.0

## @chat-adapter/telegram@4.30.0

### Minor Changes

- 5461ea9: Add native Telegram private chat draft streaming with
fallback streaming elsewhere.

### Patch Changes

- 9b8d8c4: expand npm `keywords` for adapter and state packages to
improve discoverability (adds `chat-sdk`, `chatbot`, `ai-agent`,
`ai-sdk`, `vercel`, plus platform-specific terms)
-   Updated dependencies [5461ea9]
    -   chat@4.30.0
    -   @chat-adapter/shared@4.30.0

## @chat-adapter/twilio@4.30.0

### Minor Changes

- 25ebc3b: add Twilio SMS, MMS, and voice helpers with webhook,
messaging, and formatting primitives

### Patch Changes

- 9b8d8c4: expand npm `keywords` for adapter and state packages to
improve discoverability (adds `chat-sdk`, `chatbot`, `ai-agent`,
`ai-sdk`, `vercel`, plus platform-specific terms)
-   Updated dependencies [5461ea9]
    -   chat@4.30.0
    -   @chat-adapter/shared@4.30.0

## @chat-adapter/whatsapp@4.30.0

### Minor Changes

- ffc43fc: Add WhatsApp typing indicator support by sending Meta's
read-plus-typing payload when a recent inbound message is available.
Update the default API version to v25.0.

### Patch Changes

- 9b8d8c4: expand npm `keywords` for adapter and state packages to
improve discoverability (adds `chat-sdk`, `chatbot`, `ai-agent`,
`ai-sdk`, `vercel`, plus platform-specific terms)
-   Updated dependencies [5461ea9]
    -   chat@4.30.0
    -   @chat-adapter/shared@4.30.0

## chat@4.30.0

### Minor Changes

- 5461ea9: Add native Telegram private chat draft streaming with
fallback streaming elsewhere.

## @chat-adapter/discord@4.30.0

### Patch Changes

- 9b8d8c4: expand npm `keywords` for adapter and state packages to
improve discoverability (adds `chat-sdk`, `chatbot`, `ai-agent`,
`ai-sdk`, `vercel`, plus platform-specific terms)
-   Updated dependencies [5461ea9]
    -   chat@4.30.0
    -   @chat-adapter/shared@4.30.0

## @chat-adapter/gchat@4.30.0

### Patch Changes

- 9b8d8c4: expand npm `keywords` for adapter and state packages to
improve discoverability (adds `chat-sdk`, `chatbot`, `ai-agent`,
`ai-sdk`, `vercel`, plus platform-specific terms)
- 177735a: - Fix redundant mailto link rendering in Google Chat adapter
- Google Chat adapter was emitting redundant `<mailto:...|...>` tokens
when rendering autolinked email addresses. This change collapses
`mailto:` URLs when the visible text equals the email address, ensuring
cleaner output consistent with plain text rendering in Google Chat.
-   Updated dependencies [5461ea9]
    -   chat@4.30.0
    -   @chat-adapter/shared@4.30.0

## @chat-adapter/github@4.30.0

### Patch Changes

- 9b8d8c4: expand npm `keywords` for adapter and state packages to
improve discoverability (adds `chat-sdk`, `chatbot`, `ai-agent`,
`ai-sdk`, `vercel`, plus platform-specific terms)
-   Updated dependencies [5461ea9]
    -   chat@4.30.0
    -   @chat-adapter/shared@4.30.0

## @chat-adapter/linear@4.30.0

### Patch Changes

- 9b8d8c4: expand npm `keywords` for adapter and state packages to
improve discoverability (adds `chat-sdk`, `chatbot`, `ai-agent`,
`ai-sdk`, `vercel`, plus platform-specific terms)
-   Updated dependencies [5461ea9]
    -   chat@4.30.0
    -   @chat-adapter/shared@4.30.0

## @chat-adapter/messenger@4.30.0

### Patch Changes

- 9b8d8c4: expand npm `keywords` for adapter and state packages to
improve discoverability (adds `chat-sdk`, `chatbot`, `ai-agent`,
`ai-sdk`, `vercel`, plus platform-specific terms)
-   Updated dependencies [5461ea9]
    -   chat@4.30.0
    -   @chat-adapter/shared@4.30.0

## @chat-adapter/shared@4.30.0

### Patch Changes

-   Updated dependencies [5461ea9]
    -   chat@4.30.0

## @chat-adapter/teams@4.30.0

### Patch Changes

- 9b8d8c4: expand npm `keywords` for adapter and state packages to
improve discoverability (adds `chat-sdk`, `chatbot`, `ai-agent`,
`ai-sdk`, `vercel`, plus platform-specific terms)
-   Updated dependencies [5461ea9]
    -   chat@4.30.0
    -   @chat-adapter/shared@4.30.0

## @chat-adapter/web@4.30.0

### Patch Changes

- 9b8d8c4: expand npm `keywords` for adapter and state packages to
improve discoverability (adds `chat-sdk`, `chatbot`, `ai-agent`,
`ai-sdk`, `vercel`, plus platform-specific terms)
-   Updated dependencies [5461ea9]
    -   chat@4.30.0
    -   @chat-adapter/shared@4.30.0

## @chat-adapter/state-ioredis@4.30.0

### Patch Changes

- 9b8d8c4: expand npm `keywords` for adapter and state packages to
improve discoverability (adds `chat-sdk`, `chatbot`, `ai-agent`,
`ai-sdk`, `vercel`, plus platform-specific terms)
-   Updated dependencies [5461ea9]
    -   chat@4.30.0

## @chat-adapter/state-memory@4.30.0

### Patch Changes

- 9b8d8c4: expand npm `keywords` for adapter and state packages to
improve discoverability (adds `chat-sdk`, `chatbot`, `ai-agent`,
`ai-sdk`, `vercel`, plus platform-specific terms)
-   Updated dependencies [5461ea9]
    -   chat@4.30.0

## @chat-adapter/state-pg@4.30.0

### Patch Changes

- 9b8d8c4: expand npm `keywords` for adapter and state packages to
improve discoverability (adds `chat-sdk`, `chatbot`, `ai-agent`,
`ai-sdk`, `vercel`, plus platform-specific terms)
-   Updated dependencies [5461ea9]
    -   chat@4.30.0

## @chat-adapter/state-redis@4.30.0

### Patch Changes

- 9b8d8c4: expand npm `keywords` for adapter and state packages to
improve discoverability (adds `chat-sdk`, `chatbot`, `ai-agent`,
`ai-sdk`, `vercel`, plus platform-specific terms)
-   Updated dependencies [5461ea9]
    -   chat@4.30.0

## @chat-adapter/tests@4.30.0

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-06-01 18:18:35 -07:00
..

@chat-adapter/tests

npm version npm downloads

Vitest factories, matchers, and setup utilities for testing Chat SDK adapters and bots.

Installation

pnpm add -D @chat-adapter/tests

This package has chat and vitest as peer dependencies — they should already be in your project.

Factories

import {
  createMockAdapter,
  createMockChatInstance,
  createMockState,
  createTestMessage,
  mockLogger,
} from "@chat-adapter/tests";

createMockAdapter(name?, overrides?)

Returns an Adapter with every method as vi.fn() and sensible defaults. Pass overrides to swap individual methods:

const adapter = createMockAdapter("slack", {
  postMessage: vi.fn().mockResolvedValue({ id: "msg-7", raw: {} }),
});

createMockState()

Returns a StateAdapter backed by in-memory Maps — subscriptions, locks, KV, lists, and queues all work end-to-end. Includes a cache: Map<string, unknown> for direct inspection.

createMockChatInstance(options?)

Returns a ChatInstance with every process* handler as vi.fn(). Useful for adapter authors verifying their adapter dispatches incoming events through the right hook.

const state = createMockState();
const chat = createMockChatInstance({ state });
await myAdapter.handleWebhook(req); // your adapter under test
expect(chat.processMessage).toHaveBeenCalledOnce();

createTestMessage(id, text, overrides?)

Builds a Message with parsed markdown AST already wired up.

mockLogger / createMockLogger()

mockLogger is a shared Logger for tests that don't care about isolation. createMockLogger() returns a fresh one per call.

Matchers

Vitest custom matchers covering the most common Chat SDK assertions.

Auto-register via setup file

// vitest.config.ts
import { defineConfig } from "vitest/config";

export default defineConfig({
  test: {
    setupFiles: ["@chat-adapter/tests/setup"],
  },
});

Manual registration

import { matchers } from "@chat-adapter/tests/matchers";
expect.extend(matchers);

Available matchers

Matcher Asserts
expect(adapter).toHavePosted(threadId, textPattern?) adapter.postMessage was called for this thread (and message text matches textPattern if given)
expect(adapter).toHaveEdited(threadId, messageId, textPattern?) adapter.editMessage was called for this message (and text matches textPattern if given)
expect(adapter).toHaveDeleted(threadId, messageId) adapter.deleteMessage was called for this message
expect(adapter).toHaveReactedWith(threadId, messageId, emoji) adapter.addReaction was called with the emoji (string or EmojiValue.name)
expect(adapter).toHaveStartedTyping(threadId) adapter.startTyping was called for this thread
expect(adapter).toHavePostedToChannel(channelId, textPattern?) adapter.postChannelMessage was called for this channel
expect(chat).toHaveDispatched(handler) The named process* handler on the mock ChatInstance was called
expect(state).toBeSubscribedTo(threadId) state.isSubscribed(threadId) resolves to true (async — needs await)
expect(adapter).toHavePosted("slack:C1:t1", /hello/);
expect(adapter).toHaveEdited("slack:C1:t1", "msg-1", /updated/);
expect(adapter).toHaveDeleted("slack:C1:t1", "msg-1");
expect(adapter).toHaveReactedWith("slack:C1:t1", "msg-1", "thumbsup");
expect(adapter).toHaveStartedTyping("slack:C1:t1");
expect(adapter).toHavePostedToChannel("slack:C1");
expect(chat).toHaveDispatched("processMessage");
await expect(state).toBeSubscribedTo("slack:C1:t1");

Text-pattern matchers (toHavePosted, toHaveEdited, toHavePostedToChannel) extract a comparable string from AdapterPostableMessage — handling plain strings, PostableMarkdown.markdown, PostableRaw.raw, and PostableCard.fallbackText. AST-shaped messages (PostableAst) and cards without fallbackText aren't text-matchable; assert without textPattern and inspect mock.calls directly for deeper checks.

Audience

  • Bot authors — drive simulated events through your handlers, assert on outbound calls.
  • Adapter authors — verify your Adapter implementation routes webhooks through the right ChatInstance.process* hook with the right normalized payload.

Adapter-specific helpers (e.g. signed Slack webhook builders, Teams claim builders) live in each adapter's own /testing subpath, not in this kit.