Skip to content

Commit

Permalink
docs: πŸ“ add testing library docs
Browse files Browse the repository at this point in the history
  • Loading branch information
yjaaidi committed Nov 3, 2023
1 parent ba44dec commit aec49dc
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion docs/302-recipe-search-integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
git checkout origin/testing-303-recipe-search-integration-starter
```

# 🎯 Goal: Test `<wm-recipe-search>`
# 🎯 Goal #1: Test `<wm-recipe-search>`

Same goal as [previous exercise](301-recipe-search-isolated.md) _(i.e. `<wm-recipe-search>` should call `RecipeRepository.search()` on startup.)_

Expand Down Expand Up @@ -37,6 +37,23 @@ pnpm test --watch

3. Checkout the implementation as mentioned at step 0 if you didn't do it already.

# 🎯 Goal #2: Test `<wm-recipe-search>` using `@testing-library/angular`

Refactor the previous test using `@testing-library/angular` instead of `TestBed`.

## 🍴 Cutleries
- [render](https://testing-library.com/docs/angular-testing-library/api#render)
- `configureTestBed` option:
```ts
render(..., {
configureTestBed(testBed) {
testBed.inject(MyService).doSomething()
}
});
```
- [queries](https://testing-library.com/docs/queries/about/)


# Appendices

## 🎁 Tip: Query DOM with `fixture.debugElement`
Expand Down

0 comments on commit aec49dc

Please sign in to comment.