Skip to content

How to test an httpResource triggering an httpResource? #68808

@rkrisztian

Description

@rkrisztian

Describe the problem that you experienced

I am trying to write a test case for when the result of an httpResource would trigger another httpResource, without having a component context (that is, when testing a service). For now I am failing to find a way to make the following test work:

Enter the URL of the topic with the problem

https://angular.dev/guide/http/http-resource#testing-an-httpresource

Describe what you were looking for in the documentation

I was looking for details on how I can control the triggering of the loading of individual httpResources and waiting for them to load one by one.

Describe the actions that led you to experience the problem

Let's say I have an app that administers a catalog of dogs where the app on load would not only load the list of dogs but also automatically select the first dog and open its details. And once I added this automatic selection of the first dog with linkedSignal, my tests started breaking, even if the tests had nothing to do with checking the dog details.

Describe what you want to experience that would fix the problem

The documentation should tell more info about how we can resolve situations like this when there is a chain of httpResource requests where one triggers the other, so that the app can eventually become stable. As a follow-up problem, I should be able to be in control of whether my test wants the next request to be triggered.

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

My test code used Angular 20, but the problem is also reproducible with Angular 21.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: docsRelated to the documentationgemini-triagedLabel noting that an issue has been triaged by gemini

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions