@@ -1701,25 +1701,24 @@ class Employee {
1701
1701
** [ ⬆ back to top] ( #table-of-contents ) **
1702
1702
1703
1703
## ** 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
1721
1720
1722
- ** Bad :**
1721
+ ** Không tốt :**
1723
1722
``` javascript
1724
1723
const assert = require (' assert' );
1725
1724
@@ -1742,7 +1741,7 @@ describe('MakeMomentJSGreatAgain', () => {
1742
1741
});
1743
1742
```
1744
1743
1745
- ** Good :**
1744
+ ** Tốt :**
1746
1745
``` javascript
1747
1746
const assert = require (' assert' );
1748
1747
@@ -1766,7 +1765,7 @@ describe('MakeMomentJSGreatAgain', () => {
1766
1765
});
1767
1766
});
1768
1767
```
1769
- ** [ ⬆ back to top ] ( #table-of-contents ) **
1768
+ ** [ ⬆ về đầu trang ] ( #table-of-contents ) **
1770
1769
1771
1770
## ** Concurrency**
1772
1771
### Use Promises, not callbacks
0 commit comments