bobbai00 opened a new pull request, #5274: URL: https://github.com/apache/texera/pull/5274
### What changes were proposed in this PR? The agent service had low automated test coverage (~52% line / ~54% function), concentrated in its core logic. This PR adds unit tests for the previously under-tested modules: | Area | New test file(s) | | --- | --- | | API clients (mocked `fetch`, positive + non-ok + malformed) | `api/workflow-api.test.ts`, `api/compile-api.test.ts`, `api/backend-api.test.ts` | | JWT decode / expiry / auth headers | `api/auth-api.test.ts` | | System prompt builder (operator filtering, UDF guides) | `agent/prompts.test.ts` | | Context assembly (completed/ongoing tasks, DAG, results) | `agent/util/context-utils.test.ts` | | Operator materialization & input-schema resolution | `agent/util/workflow-utils.test.ts` | | Workflow CRUD tools (add/modify/delete, error paths) | `agent/tools/workflow-crud-tools.test.ts` | | Workflow execution tool (validation, run, formatting, failures) | `agent/tools/workflow-execution-tools.test.ts` | | `TexeraAgent` in-memory surface (state, settings, tools, lifecycle) | `agent/texera-agent.test.ts` | A shared operator-metadata fixture (`agent/util/metadata-fixture.ts`) lets tests run without a live backend. No production code was changed. Coverage (`bun test --coverage`): **line 51.6% → 88.5%, function 54.2% → 90.0%**. ### Any related issues, documentation, discussions? Closes #5266 ### How was this PR tested? ``` cd agent-service bun test # 165 pass, 0 fail, 372 expect() calls bun run typecheck # tsc --noEmit, clean bun run format:check ``` Both positive and negative paths are covered (invalid input, missing config, non-ok HTTP responses, malformed responses). ### Was this PR authored or co-authored using generative AI tooling? Generated-by: Claude Opus 4.8 (1M context) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
