I've got a component called DummyService
that helps me developing my components by firing mock data into my ngxs-store
. I use this DummyService
only if I run my UI server locally. To use DummyService
, I let it injected into the component I want to test on its own. With "test" I mean testing the component in my browser using ng serve
, not testing by ng test
.
So if developing a new component, the constructor of it look like this:
constructor(
... whatever "real" parameters here ...,
x: DummyService <-- this one is only if developing locally
) {}
I know there are better ways for this, but it's built like this and let's say I've got no control over the way of using it.
Now you know what's coming next. The new component injecting the DummyService
sometimes gets checked in like this and even the tests run through, so noone's noticing it right then.
So the question is: how can I make the tests fail if this constellation occurs? What's the best way of it?
Aucun commentaire:
Enregistrer un commentaire