Files
vercel__chat/packages/integration-tests
Aamir Jawaid a0f508eee6 Migrate from BotFramework to TeamsSDK (#302)
* Migrate Teams adapter from botbuilder to @microsoft/teams.apps

Replace botbuilder/botframework-connector with @microsoft/teams.apps (TeamsSDK v2.0.6).

Breaking changes:
- Remove certificate auth (TeamsAuthCertificate) — use token or managedIdentityClientId instead
- Env vars changed: TEAMS_APP_ID → CLIENT_ID, TEAMS_APP_PASSWORD → CLIENT_SECRET, TEAMS_APP_TENANT_ID → TENANT_ID
- Reactions now work (addReaction/removeReaction) instead of throwing NotImplementedError
- Graph API calls use @microsoft/teams.graph-endpoints typed endpoints

Key changes:
- BridgeHttpAdapter captures TeamsSDK route handler for serverless dispatch
- Event handlers registered via app.on() (message, messageReaction, card.action, conversationUpdate, installationUpdate)
- Outbound calls use app.send() and app.api.conversations.activities()
- Stream support via post+edit (native HttpStream when SDK exports it)
- Graph API uses typed endpoints from @microsoft/teams.graph-endpoints
- isMention detection via activity entities instead of bot name matching

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

* Align TeamsAdapterConfig with AppOptions from TeamsSDK

- Replace custom config fields with Pick<AppOptions, ...>
  clientId (was appId), clientSecret (was appPassword), tenantId (was appTenantId)
- Remove TeamsAuthFederated, appType — use managedIdentityClientId directly
- Constructor passes config through to App (App handles env var resolution)
- Use this.app.id instead of this.config.appId for bot identity checks
- 3 replay-fetch-messages tests have known failures (type shape mismatch)

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

* Remove api() getter, add handler type safety

- Remove useless private api() getter, use this.app.api directly
- Type handlers with specific activity types:
  handleMessageActivity(ctx: IActivityContext<IMessageActivity>)
  handleAdaptiveCardAction(ctx: IActivityContext<IAdaptiveCardActionInvokeActivity>)
  handleReactionFromContext(ctx: IActivityContext<IMessageReactionActivity>)
- Remove unnecessary casts now that ctx.activity is properly typed

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

* Revert bot.tsx example changes from migration branch

Keep Azure OpenAI and DM handler changes as local-only, not part of the migration.

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

* Revert example package.json from migration branch

Keep only adapters.ts config changes, revert package.json dep changes.

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

* Remove unrelated skill files from migration branch

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

* Fix

* Update README for TeamsSDK migration

- New env vars: CLIENT_ID, CLIENT_SECRET, TENANT_ID
- New config: clientId, clientSecret, tenantId, token, managedIdentityClientId
- Remove certificate auth docs (dropped)
- Reactions now supported (add/remove)
- Typing indicator now supported
- Graph API uses @microsoft/teams.graph-endpoints
- Note streaming and modals status

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

* Revert "Update README for TeamsSDK migration"

This reverts commit 729fe463c1.

* update readme

* Refactor adapter-teams: extract types, errors, and graph-api modules

Split the 2,114-line index.ts into focused modules:
- types.ts: TeamsAdapterConfig, TeamsThreadId, TeamsChannelContext
- errors.ts: handleTeamsError as standalone pure function
- graph-api.ts: TeamsGraphReader class with all Graph API read methods

index.ts shrinks to ~1,133 lines, delegating graph reads to TeamsGraphReader
which receives dependencies via constructor injection.

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

* Clean up tests

* Do not break public facing config.

* Use previous .env vars

* Fix tests

* Fix webhook concurrency issue

* Remove support for reactions

* Fetch aadgroup id if it doesn't exist

* Fix lint and formatting issues in Teams adapter

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

* Fix README to match public API, fix 403 error mapping, correct NotImplementedError args, remove stale test aliases, and add changeset

* Fix remaining mockBotAdapter references and trailing whitespace

* fix graph pagination

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Ben Sabic <bensabic@users.noreply.github.com>
2026-03-31 15:31:50 +11:00
..
2026-01-02 15:40:52 -08: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

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