<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/testing-angular-container-components-xlypyjr0v" -->

---
title: Testing Angular container components | daily.dev
description: A practical guide to unit testing Angular container components without the Angular TestBed, covering how to test RxJS observables, stub service dependencies,...
canonical: https://daily.dev/posts/testing-angular-container-components-xlypyjr0v
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Testing Angular container components | daily.dev
og:description: A practical guide to unit testing Angular container components without the Angular TestBed, covering how to test RxJS observables, stub service dependencies,...
og:url: https://daily.dev/posts/testing-angular-container-components-xlypyjr0v
og:image: https://api.daily.dev/og/posts/XLypyJR0v.png
og:image:alt: Testing Angular container components
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Testing Angular container components

**[Playful Programming](https://daily.dev/sources/playfulprogramming)** · [@layzeedk](https://daily.dev/layzeedk) · 12 min read · 0 upvotes · 0 comments

## Summary

A practical guide to unit testing Angular container components without the Angular TestBed, covering how to test RxJS observables, stub service dependencies, and verify application state commands. Demonstrates using fakeAsync and tick for async testing, Jasmine spy objects for service stubs, and testing both optimistic and pessimistic update strategies for hero addition and deletion. Skipping Angular compilation per test case yields significantly faster unit tests.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://playfulprogramming.com/posts/testing-angular-container-components-33io>

---

Tags: [#testing](https://daily.dev/tags/testing), [#typescript](https://daily.dev/tags/typescript), [#angular](https://daily.dev/tags/angular), [#rxjs](https://daily.dev/tags/rxjs)

[View this post on daily.dev](https://daily.dev/posts/testing-angular-container-components-xlypyjr0v)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Testing Angular container components","url":"https://daily.dev/posts/testing-angular-container-components-xlypyjr0v","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/testing-angular-container-components-xlypyjr0v"},"datePublished":"2026-03-16T21:47:04.152Z","dateModified":"2026-03-17T18:01:50.785Z","description":"A practical guide to unit testing Angular container components without the Angular TestBed, covering how to test RxJS observables, stub service dependencies,...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/af226a08f5be6770c41d97764ccf1035?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/af226a08f5be6770c41d97764ccf1035?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Playful Programming","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Person","name":"Lars Gyrup Brink Nielsen","url":"https://daily.dev/layzeedk","image":"https://avatars1.githubusercontent.com/u/6364586?v=4","description":"Tech Writer, Tech Speaker, FOSS Maintainer, Microsoft MVP.","interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"EndorseAction"},"userInteractionCount":410}},"commentCount":0,"discussionUrl":"https://daily.dev/posts/testing-angular-container-components-xlypyjr0v","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"testing,typescript,angular,rxjs","timeRequired":"PT12M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Playful Programming","item":"https://daily.dev/sources/playfulprogramming"},{"@type":"ListItem","position":3,"name":"Testing Angular container components"}]}
```

