Skip to content

Commit 0d24cf6

Browse files
authored
Merge pull request hienvd#3 from hienvd/feature/6-testing
Translate 6.Testing
2 parents fc3175b + e7f5668 commit 0d24cf6

File tree

1 file changed

+19
-20
lines changed

1 file changed

+19
-20
lines changed

README.md

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1701,25 +1701,24 @@ class Employee {
17011701
**[⬆ back to top](#table-of-contents)**
17021702

17031703
## **Testing**
1704-
Testing is more important than shipping. If you have no tests or an
1705-
inadequate amount, then every time you ship code you won't be sure that you
1706-
didn't break anything. Deciding on what constitutes an adequate amount is up
1707-
to your team, but having 100% coverage (all statements and branches) is how
1708-
you achieve very high confidence and developer peace of mind. This means that
1709-
in addition to having a great testing framework, you also need to use a
1710-
[good coverage tool](http://gotwarlost.github.io/istanbul/).
1711-
1712-
There's no excuse to not write tests. There's [plenty of good JS test frameworks]
1713-
(http://jstherightway.org/#testing-tools), so find one that your team prefers.
1714-
When you find one that works for your team, then aim to always write tests
1715-
for every new feature/module you introduce. If your preferred method is
1716-
Test Driven Development (TDD), that is great, but the main point is to just
1717-
make sure you are reaching your coverage goals before launching any feature,
1718-
or refactoring an existing one.
1719-
1720-
### Single concept per test
1704+
Testing thì quan trọng hơn shipping. Nếu bạn không có test hoặc không đủ,
1705+
thì mỗi lần ship code bạn sẽ không chắc là mình có làm hư hại thứ gì không.
1706+
Việc quyết định những gì để tạo thành số lượng test đủ là do team của bạn,
1707+
nhưng việc có 100% độ bao phủ (tất cả các câu lệnh và rẽ nhánh) là cách để
1708+
bạn đạt được sự tự tin cao. Điều này có nghĩa ngoài việc có được một framework
1709+
để test tốt, bạn cũng cần sử dụng một [công cụ bao phủ tốt](http://gotwarlost.github.io/istanbul/).
1710+
1711+
Không có lí do gì để không viết test. Có [rất nhiều framework test JS tốt](http://jstherightway.org/#testing-tools),
1712+
vì thế hãy tìm một framework mà team bạn thích. Khi đã tìm được một cái thích
1713+
hợp với team của mình, hãy đặt mục tiêu để luôn luôn viết test cho mỗi tính
1714+
năng hoặc module mới của bạn. Nếu phương pháp test ưa thích của bạn là Test
1715+
Driven Development (TDD), điều đó thật tuyệt, nhưng điểm quan trọng là phải
1716+
chắc chắn bạn đạt được mục tiêu về độ bao phủ trước khi launch một tính năng
1717+
hoặc refactor một tính năng cũ nào đó.
1718+
1719+
### Một khái niệm duy nhất cho mỗi đơn vị test
17211720

1722-
**Bad:**
1721+
**Không tốt:**
17231722
```javascript
17241723
const assert = require('assert');
17251724

@@ -1742,7 +1741,7 @@ describe('MakeMomentJSGreatAgain', () => {
17421741
});
17431742
```
17441743

1745-
**Good:**
1744+
**Tốt:**
17461745
```javascript
17471746
const assert = require('assert');
17481747

@@ -1766,7 +1765,7 @@ describe('MakeMomentJSGreatAgain', () => {
17661765
});
17671766
});
17681767
```
1769-
**[back to top](#table-of-contents)**
1768+
**[về đầu trang](#table-of-contents)**
17701769

17711770
## **Concurrency**
17721771
### Use Promises, not callbacks

0 commit comments

Comments
 (0)