{ "id": "guide/testing-pipes", "title": "Testing Pipes", "contents": "\n\n\n
You can test pipes without the Angular testing utilities.
\n For the sample app that the testing guides describe, see the
For the tests features in the testing guides, see
TitleCasePipe
linkA pipe class has one method, transform
, that manipulates the input\nvalue into a transformed output value.\nThe transform
implementation rarely interacts with the DOM.\nMost pipes have no dependence on Angular other than the @Pipe
\nmetadata and an interface.
Consider a TitleCasePipe
that capitalizes the first letter of each word.\nHere's an implementation with a regular expression.
Anything that uses a regular expression is worth testing thoroughly.\nUse simple Jasmine to explore the expected cases and the edge cases.
\nThese are tests of the pipe in isolation.\nThey can't tell if the TitleCasePipe
is working properly as applied in the application components.
Consider adding component tests such as this one:
\n