Closed pheinicke closed 4 years ago
It looks like in this case, we have the ProfileNamePipe setup as a declaration and a provider in the module. When this happens, Angular treats them as two separate things.
I can detect this and make Shallow respect the mockPipe in both cases. This seems to be the right thing to do for consistency in the library too. I should be able to get this feature out over the weekend.
Thanks for submitting this, I'll let you know when it's added!
Just pushed a fix, try v10.1.4
Thank you, it works!
Hi!
I've written a pipe that I use in a lot of places in my project. All but one of my tests worked perfectly. This one test is for a component that calls #transform in the JS-code. All the other places I use that pipe are directly in the html-templates. Apparently, the mocked pipe does not have a "transform"-function.
The pipe:
The component:
The test:
When running the test, it fails with the error "TypeError: this.profileNamePipe.transform is not a function".
this.profileNamePipe
in this case is a MockOfProfileNamePipe. The error disappears when I.dontMock(ProfileNamePipe)
.mock(ProfileNamePipe, { transform: () => '' })
It does not disappear if I use
.mockPipe(ProfileNamePipe, () => '')
.Any help is, as always, greatly appreciated. If I can provide anything to help, please tell. Peter