jaredhanson / jaredhanson/electrolyte
Question: How to use Electrolyte IoC in tests?
- Dominant language
- JavaScript
- Stars
- 555
- Forks
- 60
- PR merge metrics
- No merged PRs in 30d
Description
Is there a way to somehow reset.reload container? That would be useful since, what I planned to do (in absence of a better idea) is to mock/modify/stub some of the injected dependencies for the purpose of a test. However, I want a clean state for the next test (usually I would reset container in beforeEach()).
If this is not the right way, can someone point me to the right direction? Electrolyte is great, but I could not find good example how to use it in tests and how to mock deps.
Another good thing would be the ability to manually add/override some component in the container - again for test mocking purposes (something similar to Angular's $provide...)
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by examining the container lifecycle and the existing test setup, especially how beforeEach() is used with injected dependencies. Determine whether a clean container reset or manual dependency overrides can support isolated tests, and document or demonstrate the supported approach for mocking dependencies.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- backend, testing-qa
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100