Skip to content

Commit e47fa0a

Browse files
committed
Genric message
1 parent a227971 commit e47fa0a

File tree

3 files changed

+6
-19
lines changed

3 files changed

+6
-19
lines changed

README.md

+5-17
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,18 @@
1-
![Header](./graphics/main-header.png 'Component Tests')
1+
![Header](./graphics/testing-best-practices-banner.png 'Node.js Testing Best Practices')
22

33
<br/>
44

5-
## Master the art of the most powerful testing technique for backend
5+
## A detailed guide to modern testing with Node.js
66

77
<br/><br/>
88

9-
# 3 things to your benefit
10-
11-
Component/integration test is an hybrid between E2E and unit tests. It's gaining a lot of popularity and going by the testing diamond model it is considered as the default technique for modern backend. Its main idea is testing an entire component (e.g., Microservice) as-is, through the API, with all the layers including database but fake anything extraneous. This brings **both** high confidence **and** great developer experience. However, doing it right, fast, exhaustive and maximizing the value demand some learning and skills. This is the mission statement of this repo. Warning: You might fall in love with testing 💚
12-
139
This repository contains:
1410

15-
**1. ✅ 40+ Best Practices List -** Detailed instructions on how to write component tests in the RIGHT way including code example and reference to the example application
16-
17-
**2. 📊 Example application -** A Complete showcase of a typical Node.js backend with performant tests setup (50 tests in 4 seconds! including database!)
18-
19-
**3. 🚀 Recipes folders -** Even more examples, each in its own folder, to cover more platform and use cases like Nest.js, Mocha, Jest, Express, Fastify (soon), message queues, authentication in tests, OpenAPI testing and more
11+
**1. ✅ 50+ Best Practices List -** Detailed instructions on how to modern tests in the RIGHT way
2012

21-
<br/><br/>
22-
23-
![Header](/graphics/component-diagram.jpg 'Component Tests')
24-
25-
<br/><br/>
13+
**2. 📊 Example application -** A Complete showcase of a typical Node.js backend with performant tests setup (40 tests in 5 seconds! including database!)
2614

27-
### 👨‍🏫 Exciting news: I've just released my super-comprehensive testing course after two years of recording and editing. [It's now on a 🎁 limited-time sale during July](https://testjavascript.com/)
15+
**3. 🚀 Advanced topics -** Go well beyond the basics. This guide covers hot topics like testing with data(base), testing interactions with external services including contracts, testing with message queues and more
2816

2917
<br/><br/>
3018

example-application/test/createOrder.callingOtherServices.test.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -111,14 +111,13 @@ describe('/api', () => {
111111
});
112112
});
113113

114-
test("When users service doesn't reply and times out, then return 503", async () => {
114+
test.only("When users service doesn't reply and times out, then return 503", async () => {
115115
//Arrange
116116
// ✅ Best Practice: Let nock fail fast a timeout scenario (or use "fake timers" to simulate long requests withou actually slowing down the tests)
117117
process.env.HTTP_TIMEOUT = '2000';
118118
testSetup.removeUserNock();
119119
nock('http://localhost')
120120
.get('/user/1')
121-
.times(1)
122121
.delay(3000)
123122
.reply(200, { id: 1, name: 'John' });
124123
const orderToAdd = {
220 KB
Loading

0 commit comments

Comments
 (0)