ServerJS/Unit Testing/A: Difference between revisions

Jump to navigation Jump to search
m
typos and refinements
(Wrote up a unit testing proposal in normative terms.)
 
m (typos and refinements)
Line 30: Line 30:
The truth assertion tests whether a value is identical to <tt>true</tt>, as determined by the <tt>===</tt> operator.
The truth assertion tests whether a value is identical to <tt>true</tt>, as determined by the <tt>===</tt> operator.


  assert.isTrue(value, [message]);
  assert.isTrue(actual, [message]);


Falsity:
Falsity:


  assert.isFalse(value, [message]);
  assert.isFalse(actual, [message]);


The nullity assertion tests whether a value is identical to <tt>null</tt>, as determined by the <tt>===</tt> operator.  <tt>undefined</tt> is equal but not equivalent to <tt>null</tt>, so checking whether a value is null or undefined can be determined by <tt>assert.eq(value)</tt>.
The nullity assertion tests whether a value is identical to <tt>null</tt>, as determined by the <tt>===</tt> operator.  <tt>undefined</tt> is equivalent but not identical to <tt>null</tt>, so checking whether a value is null or undefined can be determined by <tt>assert.eq(value)</tt>.


  assert.isNull(value, [message]);
  assert.isNull(actual, [message]);


The truthiness assertion tests whether a value is equivalent to <tt>true</tt>, as determined by the <tt>==</tt> operator.
The truthiness assertion tests whether a value is equivalent to <tt>true</tt>, as determined by the <tt>==</tt> operator.


assert.eqTrue(value, [message]);
assert.eqTrue(actual, [message]);


Falsiness:
Falsiness:


  assert.eqFalse(value, [message]);
  assert.eqFalse(actual, [message]);


Not a number:
Not a number:
171

edits

Navigation menu