Skip to content

Commit 02567cb

Browse files
committed
docs(angular): πŸ“ add angular core cookbook
1 parent 4d42510 commit 02567cb

File tree

71 files changed

+1816
-75
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+1816
-75
lines changed

β€Ž.firebasercβ€Ž

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
{
22
"projects": {
33
"default": "marmicode-cookbook"
4+
},
5+
"targets": {
6+
"marmicode-cookbook": {
7+
"hosting": {
8+
"cookbook": ["marmicode-cookbook"]
9+
}
10+
}
411
}
512
}

β€Ž.github/workflows/test.ymlβ€Ž

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,15 @@ jobs:
3838
- run: bunx nx-cloud record -- nx format:check
3939
- run: bunx nx affected -t build lint test e2e
4040
- name: πŸ” Set up service account
41-
if: github.ref == 'refs/heads/main'
4241
env:
4342
FIREBASE_SERVICE_ACCOUNT_MARMICODE_COOKBOOK: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_MARMICODE_COOKBOOK }}
4443
run: |
4544
echo $FIREBASE_SERVICE_ACCOUNT_MARMICODE_COOKBOOK > ~/.firebase-sa.json
4645
echo "GOOGLE_APPLICATION_CREDENTIALS=$HOME/.firebase-sa.json" >> "$GITHUB_ENV"
4746
- name: πŸš€ Deploy
48-
if: github.ref == 'refs/heads/main'
4947
run: bunx nx affected -t deploy --no-agents
50-
48+
- name: πŸ” Smoke test
49+
run: bunx nx run-many -t smoke
5150
- uses: actions/upload-artifact@v4
5251
if: ${{ !cancelled() }}
5352
with:

β€Ž.gitignoreβ€Ž

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,5 @@ yarn-error.log*
2525
.nx/cache
2626
.nx/workspace-data
2727
.firebase
28-
vite.config.*.timestamp*
28+
vite.config.*.timestamp*
29+
vitest.config.*.timestamp*
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
title: Introduction
3+
slug: /angular/testing
4+
---
5+
6+
# Angular Testing Cookbook
7+
8+
import { useDocsSidebar } from '@docusaurus/plugin-content-docs/client';
9+
import DocCardList from '@theme/DocCardList';
10+
import { ExternalLink } from '@site/src/components/external-link';
11+
12+
This cookbook is the complementary resource to the <ExternalLink href="https://courses.marmicode.io/courses/pragmatic-angular-testing" medium="in-article" content="angular-testing-intro">Pragmatic Angular Testing</ExternalLink> course.
13+
14+
It's for Angular developers who want to build a **pragmatic testing strategy** β€” **in opposition to dogmatic approaches** such as:
15+
16+
- _"your unit-test is not a unit-test"_
17+
- _"let's mock everything"_
18+
- _"let's go full E2E"_
19+
- _"let's target 100% coverage"_
20+
21+
You'll learn how to write tests that are fast, readable, and resilient. You'll escape the cycle of bloated mocks and brittle end-to-end tests that slow down development.
22+
23+
Many teams only realize the cost of skipping these practices after months or years of pain. Lucky you! You found this resource, so you won't have to.
24+
25+
<DocCardList items={useDocsSidebar('angular-testing').items.slice(1)}/>
Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: Beyond Unit vs. Integration
3-
slug: /angular/beyond-unit-vs-integration
3+
slug: /angular/testing/beyond-unit-vs-integration
44
toc_max_heading_level: 4
55
---
66

@@ -156,24 +156,24 @@ They are **either**:
156156

157157
Given Wide test properties, one might think that they should simply be avoided. However, Wide tests have their own advantages:
158158

159-
- They are more [symmetric to production](../../02-glossary.md#symmetric-to-production), and [predictive](../../02-glossary.md#predictive), thus more reassuring.
160-
- They are more [structure-insensitive](../../02-glossary.md#structure-insensitive) _(e.g. you can refactor your code without breaking them)_.
159+
- They are more [symmetric to production](../06-glossary.md#symmetric-to-production), and [predictive](../06-glossary.md#predictive), thus more reassuring.
160+
- They are more [structure-insensitive](../06-glossary.md#structure-insensitive) _(e.g. you can refactor your code without breaking them)_.
161161

162162
## βš–οΈ Comparing Narrow and Wide Tests {#comparing-narrow-and-wide-tests}
163163

164-
| Property | Narrow Tests | Wide Tests |
165-
| ----------------------------------------------------------------------- | --------------------- | --------------------- |
166-
| **[Speed](#fast)** | ⚑️ Fast | 🐒 Slow |
167-
| **[Isolation](#easy-to-isolate-and-parallelize)** | 🏝️ Easy to isolate | πŸ”— Harder to isolate |
168-
| **[Cognitive Load](#low-cognitive-load)** | 😌 Low cognitive load | 🀯 Harder to diagnose |
169-
| **[Precision](../../02-glossary.md#precise-tests)** | Higher Precision | Lower Precision |
170-
| **[Production-Symmetry](../../02-glossary.md#symmetric-to-production)** | Lower Symmetry | Higher Symmetry |
171-
| **[Structure-Sensitivity](../../02-glossary.md#structure-insensitive)** | Higher Sensitivity | Lower Sensitivity |
164+
| Property | Narrow Tests | Wide Tests |
165+
| -------------------------------------------------------------------- | --------------------- | --------------------- |
166+
| **[Speed](#fast)** | ⚑️ Fast | 🐒 Slow |
167+
| **[Isolation](#easy-to-isolate-and-parallelize)** | 🏝️ Easy to isolate | πŸ”— Harder to isolate |
168+
| **[Cognitive Load](#low-cognitive-load)** | 😌 Low cognitive load | 🀯 Harder to diagnose |
169+
| **[Precision](../06-glossary.md#precise-tests)** | Higher Precision | Lower Precision |
170+
| **[Production-Symmetry](../06-glossary.md#symmetric-to-production)** | Lower Symmetry | Higher Symmetry |
171+
| **[Structure-Sensitivity](../06-glossary.md#structure-insensitive)** | Higher Sensitivity | Lower Sensitivity |
172172

173173
:::tip Narrow Tests Foster Good Design
174174
It is easier to write Narrow tests for well-designed code with clear separation of concerns, and the right abstractions where we can easily replace dependencies with test doubles. Therefore **Narrow tests are more likely to foster good design**.
175175

176-
On the other hand, Over-Narrow tests can lead to [over-specification](../../02-glossary.md#over-specification) and make tests more [structure-sensitive](../../02-glossary.md#structure-insensitive) and brittle.
176+
On the other hand, Over-Narrow tests can lead to [over-specification](../06-glossary.md#over-specification) and make tests more [structure-sensitive](../06-glossary.md#structure-insensitive) and brittle.
177177
:::
178178

179179
## Which one to choose?

0 commit comments

Comments
Β (0)