You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on May 24, 2022. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+10-16Lines changed: 10 additions & 16 deletions
Original file line number
Diff line number
Diff line change
@@ -30,7 +30,7 @@ Forked from the excellent Airbnb JavaScript Style Guide, slightly modified to fi
30
30
1.[Modules](#modules)
31
31
1.[jQuery](#jquery)
32
32
1.[ES5 Compatibility](#es5)
33
-
1.[(Unit)Testing](#testing)
33
+
1.[Unit testing](#testing)
34
34
1.[Performance](#performance)
35
35
1.[Resources](#resources)
36
36
1.[In the Wild](#in-the-wild)
@@ -1425,30 +1425,24 @@ Forked from the excellent Airbnb JavaScript Style Guide, slightly modified to fi
1425
1425
**[[⬆]](#TOC)**
1426
1426
1427
1427
1428
-
## <a name='testing'>(Unit)Testing</a>
1428
+
## <a name='testing'>Unit testing</a>
1429
1429
1430
-
The first question that pops into your head might be, why should I write unit tests for client-side code. Well there are a lot reasons why you should test your code.
1430
+
- Write unit tests wherever possible but don't test vendor or library code.
1431
1431
1432
-
**Why should I write tests?**
1432
+
- Make sure all your tests pass.
1433
1433
1434
-
- Unit tests proves that your code works as you expected.
1435
-
- It is free documentation for your code.
1436
-
- You can add and change code and see directly if your changes/additions
1437
-
break something.
1438
-
- Tests are the requirements written in code.
1439
-
- Tests let you know when you can stop code, once it passes you know your code is good enough and meets the requirements.
1440
-
- etc..
1434
+
- Write descriptive tests; they should be human readable.
1441
1435
1442
-
**What should be tested?**
1443
-
What you definitely should test is your own code, and not code from a vendor or used library. This code should already be well tested.
1436
+
- Write tests to requirements, not to your specific code
1444
1437
1445
-
**How should I test?**
1446
-
This depends on the project you're going to work on. When using [Roger](https://github.com/DigitPaint/roger), you can look for our document that list and describes test-tools which form a good base for your testing environment.
1438
+
- Write positive as well as negative tests
1439
+
1440
+
- Use a testing framework like Karma to run tests in multiple environments/browsers. See our instructions on [how to set up a Karma environment](instructions/karma.md)
1447
1441
1448
-
[Read here our karma instructions](instructions/karma.md)
1449
1442
1450
1443
**Good reads:**
1451
1444
1445
+
- [Set up a Karma/Mocha/Chai base system](instructions/karma.md)
1452
1446
- [Introducing to JS Unit testing](http://www.smashingmagazine.com/2012/06/27/introduction-to-javascript-unit-testing/)
0 commit comments