this.router.url is undefined #515
Unanswered
erperejildo
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I use
createRoutingFactory
withSpectator
but I get this error:this.router.url is undefined
I created my test file following the docs:
Similar error on child component was fixed by using
ng-mocks
:but this time,
this.router.url
is being used in the component I'm testing, not in the child.I tried different approaches like this:
(more info: https://pretagteam.com/question/how-to-set-data-on-activatedroute-for-spectator-test)
but with no luck.
Also I don't get the difference from using
createRoutingFactory
andcreateServiceFactory
withmocks: [Router]
in Spectator.(more info https://netbasal.com/spectator-v4-a-powerful-tool-to-simplify-your-angular-tests-bd65a0bf317e)
Beta Was this translation helpful? Give feedback.
All reactions