I'm a developer, a community builder, and a relentless learner. I'm a Google Developer Expert in Angular, a Pluralsight author, a conference speaker, and a volunteer for women in tech groups. ❤️🍷📚
Hi there! Sorry it took me so long to respond; I didn't see this comment until now. 😬
I hear what you're saying, it is a lot of steps and I've made the mistake of not calling .flush() when testing myself. However, I do like that Angular's HttpClientTestingModule allows me to verify expected number of times a call is made without using a Jasmine spy. I also like that I can verify the HTTP method used in the call, headers, etc separately from verifying the subscribe portion.
For more complicated service calls (where there's retries, different HTTP methods, or custom headers), being able to assert separately starts making more sense.
For straightforward requests like what I have in this post, having an all-in-one solution like what you propose is a great way to go and definitely helps to make things easier. 🙂
Thank you for taking the time to read and comment! These kinds of discussions are great!
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hi there! Sorry it took me so long to respond; I didn't see this comment until now. 😬
I hear what you're saying, it is a lot of steps and I've made the mistake of not calling
.flush()
when testing myself. However, I do like that Angular'sHttpClientTestingModule
allows me to verify expected number of times a call is made without using a Jasmine spy. I also like that I can verify the HTTP method used in the call, headers, etc separately from verifying the subscribe portion.For more complicated service calls (where there's retries, different HTTP methods, or custom headers), being able to assert separately starts making more sense.
For straightforward requests like what I have in this post, having an all-in-one solution like what you propose is a great way to go and definitely helps to make things easier. 🙂
Thank you for taking the time to read and comment! These kinds of discussions are great!