Replies: 3 comments
-
Hmm, maybe try out https://www.npmjs.com/package/ng-mocks#how-to-create-a-mock-module? or create a factory function? Just a thought. |
Beta Was this translation helpful? Give feedback.
-
@wiegell u can create global injections, https://github.com/ngneat/spectator#global-injections |
Beta Was this translation helpful? Give feedback.
-
I've been able to simplify to some degree by making a "componentTestModule" and importing that, but e.g. MaterialsModule will not work in this way. Global injections is not fitting IMO, if i need to leave something out of certain tests? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm submitting a...
I have spectator working, but i feel like i'm not using it as intended. I'm recreating the parent module for every .spec file, which seems excessive. E.g.:
positions.component.spec.ts
Which is (almost) identical to my parent module:
settings.module.ts
What i would like to do is basically to copy the original SettingsModule, but override some of the injections (e.g. store). Is this possible? I'm somewhat new to testing, and couldn't figure it out from the documentation.
I read somewhere, that it's possible to do, if using "SCAM" (single component angular module), though i don't exactly see why that would make a difference?
Hope someone can enlighten me :)
Environment
Beta Was this translation helpful? Give feedback.
All reactions