Repository navigation
test(di): add comprehensive test suite for Container and ServiceLocator - #64
Conversation
- Added 23 tests for DI container - Coverage: di/container 73% → 89% - Tests: 555 → 578 passed, total 87% coverage
|
Warning Review limit reachedNext included review available in 50 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
PR Summary by QodoExpand DI container and service locator test coverage
AI Description
Diagram
High-Level Assessment
Files changed (1)
|
Code Review by Qodo
1. ServiceLocator test drops decorator
|
| ServiceLocator.container().register("singleton")(TestService) | ||
| assert TestService in ServiceLocator.container()._singletons |
There was a problem hiding this comment.
1. Servicelocator test drops decorator 🐞 Bug ≡ Correctness
test_register calls ServiceLocator.container().register("singleton")(TestService), but
register("singleton") only returns a decorator and the test does not invoke that decorator with
TestService. Consequently TestService is absent from _singletons, causing the newly added test
suite to fail.
Agent Prompt
## Issue description
The test invokes `Container.register("singleton")` but discards its returned decorator, so `TestService` is never registered and the assertion fails.
## Issue Context
`Container.register` returns `decorator`; registration occurs only when that decorator is called with the class. `ServiceLocator.register` also discards the decorator, so using the container directly still requires applying the returned decorator.
## Fix Focus Areas
- tests/test_di_container.py[198-199]
Change the test to apply the decorator, for example `ServiceLocator.container().register("singleton")(TestService)` is currently syntactically present but must be verified against the implementation; alternatively use an explicit decorator variable and call it with `TestService`, or use `register_instance`. Ensure the final assertion observes `TestService` in the singleton registry.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
Summary
Test plan