HTML and CSS Reference
In-Depth Information
As you can see, assertions tend to follow the same pattern of having an actual
value (which is usually the direct return value of a property or method), and an
expected value (which you specify and a message to describe the assertion).
The assertion methods can change, so it's best to check out the QUnit
documentation, which you can find at .
If you now run the first test by refreshing the web page in your mobile browser,
you can see that the green bar should now be red, as shown in Figure 9-3.
Figure 9-3. Failed unit test
As you can see, the failed test will also tell you where the test failed and why,
which can be useful for debugging purposes.
With the first assertion, you can now follow with the code that comes next to
complete the unit tests for the rest of the calculator.
test('calculator constructor', function(){
* Specify how many assertions this test will run.
* If assertions do not run for any reason, this
* test will fail
* Create a new calculator instance and set the initial value to 10
Search WWH ::

Custom Search