bindToComponentInputs unit test case failing #634
Unanswered
ashutoshpaul
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.
-
Is there a way i can write test case using
bindToComponentInputs
in Angular? It would be helpful to answer with a basic example.Lets say I have a route: /items/34/properties
I am fetching the id: 34 using
@Input({ transform: numberAttribute }) id!: number
in PropertiesComponent.In
properties.component.spec.ts
fileTest cases written with the help of spectator. When i add a debugger in the ts component:
Expected result:
while running test case i should get
id = 34
Actual result
while running test case
id = undefined
Also, unit tests were running successfully when
route.params.subscribe(...)
was used.Beta Was this translation helpful? Give feedback.
All reactions