Skip to content

Commit 10f0562

Browse files
authored
Merge pull request goldbergyoni#100 from DouglasMV/fixes
fixes
2 parents 7716ddf + 8be1cdd commit 10f0562

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

readme.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ describe('Products Service', function() {
160160

161161
![](https://img.shields.io/badge/🔧%20Example%20using%20Jest-blue.svg
162162
"Examples with Jest") ![](https://img.shields.io/badge/🔧%20Example%20using%20Mocha-blue.svg
163-
"Examples with Jest")
163+
"Examples with Mocha")
164164

165165
```javascript
166166
describe('Customer classifier', () => {
@@ -319,7 +319,7 @@ For example, if you want to test that your app behaves reasonably when the payme
319319

320320
### :thumbsdown: Anti-pattern example: Mocks focus on the internals
321321
![](https://img.shields.io/badge/🔧%20Example%20using%20Sinon-blue.svg
322-
"Examples with Mocha & Chai")
322+
"Examples with Sinon")
323323
```javascript
324324
it("When a valid product is about to be deleted, ensure data access DAL was called once, with the right product and right config", async () => {
325325
//Assume we already added a product
@@ -526,7 +526,7 @@ expect(menu).toMatchInlineSnapshot(`
526526
### :thumbsdown: Anti Pattern Example: tests are not independent and rely on some global hook to feed global DB data
527527

528528
![](https://img.shields.io/badge/🔧%20Example%20using%20Mocha-blue.svg
529-
"Examples with Jest")
529+
"Examples with Mocha")
530530

531531
```javascript
532532
before(() => {
@@ -585,7 +585,7 @@ A more elegant alternative is the using the one-line dedicated Chai assertion: e
585585
### :thumbsdown: Anti-pattern Example: A long test case that tries to assert the existence of error with try-catch
586586

587587
![](https://img.shields.io/badge/🔧%20Example%20using%20Mocha-blue.svg
588-
"Examples with Jest")
588+
"Examples with Mocha")
589589

590590
```javascript
591591
it("When no product name, it throws error 400", async() => {
@@ -714,7 +714,7 @@ Component tests focus on the Microservice ‘unit’, they work against the API,
714714
### :clap: Doing It Right Example: Supertest allows approaching Express API in-process (fast and cover many layers)
715715

716716
![](https://img.shields.io/badge/🔧%20Example%20using%20Mocha-blue.svg
717-
"Examples with Jest")
717+
"Examples with Mocha")
718718

719719
![alt text](assets/bp-13-component-test-yoni-goldberg.png " [Supertest](https://www.npmjs.com/package/supertest) allows approaching Express API in-process (fast and cover many layers)")
720720

@@ -1105,8 +1105,9 @@ test('Shallow/mocked approach: When clicked to show filters, filters are display
11051105

11061106
### :clap: Doing It Right Example: E2E API that resolves only when the async operations is done (Cypress)
11071107

1108-
![](https://img.shields.io/badge/🔧%20Example%20using%20React-blue.svg
1109-
"Examples with React") ![](https://img.shields.io/badge/🔧%20Example%20using%20React%20Testing%20Library-blue.svg
1108+
![](https://img.shields.io/badge/🔨%20Example%20using%20Cypress-blue.svg
1109+
"Using Cypress to illustrate the idea")
1110+
![](https://img.shields.io/badge/🔧%20Example%20using%20React%20Testing%20Library-blue.svg
11101111
"Examples with react-testing-library")
11111112

11121113
```javascript
@@ -1200,7 +1201,7 @@ test('movie title appears', async () => {
12001201

12011202
### :clap: Doing It Right Example: Stubbing or intercepting API calls
12021203
![](https://img.shields.io/badge/🔧%20Example%20using%20React-blue.svg
1203-
"Examples with React") ![](https://img.shields.io/badge/🔧%20Example%20using%20Jest-blue.svg
1204+
"Examples with React") ![](https://img.shields.io/badge/🔧%20Example%20using%20React%20Testing%20Library-blue.svg
12041205
"Examples with react-testing-library")
12051206

12061207
```javascript
@@ -1537,7 +1538,7 @@ Knowing that all or most of the mutations were killed gives much higher confiden
15371538
### :thumbsdown: Anti Pattern Example: 100% coverage, 0% testing
15381539

15391540
![](https://img.shields.io/badge/🔨%20Example%20using%20Stryker-blue.svg
1540-
"Using Cypress to illustrate the idea")
1541+
"Using Stryker")
15411542
```javascript
15421543
function addNewOrder(newOrder) {
15431544
logger.log(`Adding new order ${newOrder}`);
@@ -1623,7 +1624,7 @@ it("Test name", () => {*//error:no-identical-title. Assign unique titles to test
16231624

16241625
:white_check_mark: **Do:** Using a CI with shiny quality inspections like testing, linting, vulnerabilities check, etc? Help developers run this pipeline also locally to solicit instant feedback and shorten the [feedback loop](https://www.gocd.org/2016/03/15/are-you-ready-for-continuous-delivery-part-2-feedback-loops/). Why? an efficient testing process constitutes many and iterative loops: (1) try-outs -> (2) feedback -> (3) refactor. The faster the feedback is, the more improvement iterations a developer can perform per-module and perfect the results. On the flip, when the feedback is late to come fewer improvement iterations could be packed into a single day, the team might already move forward to another topic/task/module and might not be up for refining that module.
16251626

1626-
Practically, some CI vendors (Example: [CircleCI load CLI](https://circleci.com/docs/2.0/local-cli/)) allow running the pipeline locally. Some commercial tools like [wallaby provide highly-valuable & testing insights](https://wallabyjs.com/) as a developer prototype (no affiliation). Alternatively, you may just add npm script to package.json that runs all the quality commands (e.g. test, lint, vulnerabilities) — use tools like [concurrently](https://www.npmjs.com/package/concurrently) for parallelization and non-zero exit code if one of the tools failed. Now the developer should just invoke one command — e.g. ‘npm run quality’ — to get instant feedback. Consider also aborting a commit if the quality check failed using a githook ([husky can help](https://github.com/typicode/husky))
1627+
Practically, some CI vendors (Example: [CircleCI local CLI](https://circleci.com/docs/2.0/local-cli/)) allow running the pipeline locally. Some commercial tools like [wallaby provide highly-valuable & testing insights](https://wallabyjs.com/) as a developer prototype (no affiliation). Alternatively, you may just add npm script to package.json that runs all the quality commands (e.g. test, lint, vulnerabilities) — use tools like [concurrently](https://www.npmjs.com/package/concurrently) for parallelization and non-zero exit code if one of the tools failed. Now the developer should just invoke one command — e.g. ‘npm run quality’ — to get instant feedback. Consider also aborting a commit if the quality check failed using a githook ([husky can help](https://github.com/typicode/husky))
16271628
<br/>
16281629

16291630
**Otherwise:** When the quality results arrive the day after the code, testing doesn’t become a fluent part of development rather an after the fact formal artifact
@@ -1765,7 +1766,7 @@ An efficient update policy may allow some ‘vesting period’ — let the c
17651766
<br/>
17661767

17671768
### :clap: Example: [ncu](https://www.npmjs.com/package/npm-check-updates) can be used manually or within a CI pipeline to detect to which extent the code lag behind the latest versions
1768-
![alt text](assets/bp-27-yoni-goldberg-npm.png "Nncu can be used manually or within a CI pipeline to detect to which extent the code lag behind the latest versions")
1769+
![alt text](assets/bp-27-yoni-goldberg-npm.png "ncu can be used manually or within a CI pipeline to detect to which extent the code lag behind the latest versions")
17691770

17701771
</details>
17711772

0 commit comments

Comments
 (0)