Skip to content

angular.dev: no documentation on how to test interceptors #54390

@saithis

Description

@saithis

Describe the problem that you experienced

I wrote a functional interceptor which also uses inject and couldn't find help on how to write a test for this on angular.dev.
I would have expected it on either of these pages:
https://angular.dev/guide/http/testing
https://angular.dev/guide/http/interceptors

Enter the URL of the topic with the problem

https://angular.dev/guide/http/testing

Describe what you were looking for in the documentation

An example on how to write tests for interceptors

Describe the actions that led you to experience the problem

I wrote a functional interceptor which also uses inject.
Then I wanted to write a test for it and didn't know how to do it. Mainly because of the use of inject.
angular.dev didn't provide any help.

Describe what you want to experience that would fix the problem

Documentation about it

Add a screenshot if that helps illustrate the problem

No response

If this problem caused an exception or error, please paste it here

No response

If the problem is browser-specific, please specify the device, OS, browser, and version

No response

Provide any additional information here in as much as detail as you can

Found this post then, which helped me: https://blog.stackademic.com/how-to-test-a-functional-interceptor-in-angular-6c8095c1fb7d#ed8b

But official documentation would be nice.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: docsRelated to the documentation

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions