Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What's the recommended way to inject mock dependencies for testing in this framework? #4

Open
antoniogamiz opened this issue Dec 26, 2020 · 1 comment

Comments

@antoniogamiz
Copy link

No description provided.

@luvies
Copy link
Owner

luvies commented Jul 18, 2021

There isn't a recommended way, but it would be worth making one I think. I've seen something like the following used in Node DI frameworks:

if (NODE_ENV === "production") {
  serviceCollection.addTransient(IA, A);
  serviceCollection.addScoped(IB, B);
  serviceCollection.addSingleton(IC, C);
} else if (NODE_ENV === "test") {
  serviceCollection.addTransient(IA, TestA);
  serviceCollection.addScoped(IB, TestB);
  serviceCollection.addSingleton(IC, TestC);
}

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

No branches or pull requests

2 participants