Skip to content

test: add unit tests for TypeScript ChainAgent and BedrockFlowsAgent#540

Open
nuthalapativarun wants to merge 1 commit into
2FastLabs:mainfrom
nuthalapativarun:test/539-ts-chain-flows-agent-tests
Open

test: add unit tests for TypeScript ChainAgent and BedrockFlowsAgent#540
nuthalapativarun wants to merge 1 commit into
2FastLabs:mainfrom
nuthalapativarun:test/539-ts-chain-flows-agent-tests

Conversation

@nuthalapativarun

Copy link
Copy Markdown

Issue Link (REQUIRED)

Fixes #539

Summary

Changes

Adds unit test coverage for two previously untested TypeScript agents:

ChainAgent.test.ts (12 tests)

  • Constructor: empty-agents guard throws, single-agent init, custom defaultOutput
  • processRequest: single-agent pass-through, multi-agent pipeline (output of agent N becomes input to agent N+1), additionalParams forwarded to every agent, default response on empty content, last-agent streaming allowed, intermediate streaming returns default response, agent error propagates

BedrockFlowsAgent.test.ts (8 tests)

  • Constructor: no-region default client, region-specific client, pre-built client bypass, enableTrace default/set
  • processRequest: happy-path flow invocation + decode, missing response stream error, custom flowInputEncoder, custom flowOutputDecoder, client-level error wrapping

Both files follow the same mock/describe/it structure as the existing LambdaAgent.test.ts.

User experience

Before: npx jest produced no output for ChainAgent or BedrockFlowsAgent.

After: 20 new assertions covering the core behaviour and error paths of both agents.

Checklist

  • I have performed a self-review of this change
  • Changes have been tested
  • Changes are documented
  • I have linked this PR to an existing issue (required)

Acknowledgment

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Adds ChainAgent.test.ts (12 tests) covering constructor validation, the
chaining pipeline, passthrough of additionalParams, streaming on the
last agent, error propagation, and defaultOutput fallback.

Adds BedrockFlowsAgent.test.ts (8 tests) covering constructor options,
processRequest happy path, custom encoder/decoder, missing response
stream, and client error wrapping.

Closes 2FastLabs#539
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 TypeScript ChainAgent and BedrockFlowsAgent

1 participant