Skip to content
This repository was archived by the owner on May 24, 2022. It is now read-only.

Commit 3e855c0

Browse files
author
Flurin Egger
committed
Remove testing rationale and add do’s and don’ts instead
1 parent aae9a71 commit 3e855c0

File tree

1 file changed

+10
-16
lines changed

1 file changed

+10
-16
lines changed

README.md

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Forked from the excellent Airbnb JavaScript Style Guide, slightly modified to fi
3030
1. [Modules](#modules)
3131
1. [jQuery](#jquery)
3232
1. [ES5 Compatibility](#es5)
33-
1. [(Unit)Testing](#testing)
33+
1. [Unit testing](#testing)
3434
1. [Performance](#performance)
3535
1. [Resources](#resources)
3636
1. [In the Wild](#in-the-wild)
@@ -1425,30 +1425,24 @@ Forked from the excellent Airbnb JavaScript Style Guide, slightly modified to fi
14251425
**[[⬆]](#TOC)**
14261426

14271427

1428-
## <a name='testing'>(Unit)Testing</a>
1428+
## <a name='testing'>Unit testing</a>
14291429

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.
14311431
1432-
**Why should I write tests?**
1432+
- Make sure all your tests pass.
14331433
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.
14411435
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
14441437
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)
14471441
1448-
[Read here our karma instructions](instructions/karma.md)
14491442
14501443
**Good reads:**
14511444
1445+
- [Set up a Karma/Mocha/Chai base system](instructions/karma.md)
14521446
- [Introducing to JS Unit testing](http://www.smashingmagazine.com/2012/06/27/introduction-to-javascript-unit-testing/)
14531447
- [Writing testable code](http://alistapart.com/article/writing-testable-javascript)
14541448
- [JS Unit testing and why](http://thomas.junghans.co.za/blog/2013/06/25/javascript-unit-testing-and-why/)

0 commit comments

Comments
 (0)