Added comprehensive tests for core components #12
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This pull request addresses the "Limited Test Coverage for Core Components" issue by introducing a comprehensive suite of unit and integration tests for the
fasta2a
library's core components.[cite_start]Previously, the test suite only validated the agent card endpoint (
/.well-known/agent.json
) tests/test_applications.py, leaving critical components likeTaskManager
Broker
Storage
Worker
without any test coverage. This gap could allow bugs in the main task processing logic to go unnoticed.
Solution
To resolve this, I have added the following new test files:
tests/test_storage.py
: Adds unit tests for theInMemoryStorage
class[cite: 1265]. These tests verify the functionality of submitting, loading, and updating tasks, as well as managing the conversation context.tests/test_broker.py
: Tests theInMemoryBroker
[cite: 1045] to ensure that task operations are correctly sent and received through its in-memory message stream.tests/test_task_manager.py
: Introduces an integration test for theTaskManager
that simulates the full, end-to-end lifecycle of a task. It uses aMockWorker
to confirm that tasks are correctly submitted via theTaskManager
, processed by a worker, and that their final state is accurately reflected in storage.These tests are designed to be robust and handle the asynchronous nature of the library, preventing the race conditions and deadlocks encountered during development.
Value