Skip to content

test: add unit tests for CodeExecutionRequestProcessor and CodeExecutionResponseProcessor#402

Closed
nuthalapativarun wants to merge 1 commit into
google:mainfrom
nuthalapativarun:test/code-execution-request-processor
Closed

test: add unit tests for CodeExecutionRequestProcessor and CodeExecutionResponseProcessor#402
nuthalapativarun wants to merge 1 commit into
google:mainfrom
nuthalapativarun:test/code-execution-request-processor

Conversation

@nuthalapativarun

Copy link
Copy Markdown
Contributor

Please ensure you have read the contribution guide before creating a pull request.

Link to Issue or Description of Change

Adds unit tests for core/src/agents/processors/code_execution_request_processor.ts, which had no test coverage. The tests focus on the early-exit guard paths in both processors, verifying that they short-circuit correctly before reaching the complex code-execution logic that requires a live executor.

CodeExecutionRequestProcessor.runAsync — 3 tests:

  • Non-LlmAgent agent → yields no events, leaves request unchanged
  • LlmAgent with no codeExecutor → yields no events
  • LlmAgent with a BaseCodeExecutor (non-built-in, optimizeDataFile = false) → runs runPreProcessor and exits cleanly; contents preserved

CodeExecutionResponseProcessor.runAsync — 5 tests:

  • Partial response → yields no events (skips post-processing)
  • Non-LlmAgent → yields no events
  • LlmAgent with no codeExecutor → yields no events
  • Response with no content → yields no events
  • Response content with no code block → yields no events (no code to extract)

Testing Plan

Unit Tests:

  • I have added or updated unit tests for my change.
  • All unit tests pass locally.
✓ core/test/agents/processors/code_execution_request_processor_test.ts (8 tests) 6ms
Test Files: 1 passed (1)
     Tests: 8 passed (8)

Manual End-to-End (E2E) Tests:
Pure unit tests with no dependencies on external services.

Checklist

  • Read CONTRIBUTING.md
  • Self-reviewed code
  • Commented hard-to-understand areas
  • Added tests proving fix/feature works
  • Unit tests pass locally
  • Manually tested end-to-end
  • Dependent changes merged/published

@kalenkevich

Copy link
Copy Markdown
Collaborator

@nuthalapativarun Hello, thanks for all your contributions. Can you please consolidate your docs and test PRs into 1?
Thanks!

@nuthalapativarun

Copy link
Copy Markdown
Contributor Author

Closing in favour of the consolidated PR #413, as requested by @kalenkevich. All changes from this PR are included there.

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.

2 participants