dependencies icon indicating copy to clipboard operation
dependencies copied to clipboard

Add service locator with mocks contr-example.

Open proofit404 opened this issue 8 years ago • 0 comments

Service locator needs massive changes in the code base. We can avoid it with TestInjector or Mocker which will need to define ones.

So if we need to add injection to the callable:

  • With Mocker add one argument to the global TestInjector.
  • With service locator change each call to @mock.patch(services, ... in each test method.

Why not call argument example:

Aka props drilling
foo(x, y)
-> bar(x)
  -> baz(x)
    -> quiz(y)

Instead of passing y argument all the way down to quiz, quiz itself can be bound to y. So bar and baz does not need to know about quiz implementation details (like y value).

Untitled

Untitled

proofit404 avatar May 15 '17 02:05 proofit404