Module ringo/unittest
Functions
- assertEqual(val1, val2)
- assertFalse(val)
- assertMatch(val, rxp)
- assertNaN(val)
- assertNotEqual(val1, val2)
- assertNotNaN(val)
- assertNotNull(val)
- assertNotUndefined(val)
- assertNull(val)
- assertStringContains(val, str)
- assertThrows(func, exception)
- assertTrue(val)
- assertUndefined(val)
- jsDump(value, lvl)
- run(modulePathOrScope, writer)
assertEqual (val1, val2)
Checks if the values passed as arguments are equal.
Parameters
| Object | val1 | The value that should be compared to the second argument. |
| Object | val2 | The value that should be compared to the first argument. |
Throws
assertFalse (val)
Checks if the value passed as argument is boolean false.
Parameters
| Object | val | The value that should be boolean false. |
Throws
assertMatch (val, rxp)
Checks if the regular expression matches the string.
Parameters
| String | val | The string that should contain the regular expression pattern |
| RegExp | rxp | The regular expression that should match the value |
Throws
assertNaN (val)
Checks if the value passed as argument is NaN.
Parameters
| Object | val | The value that should be NaN. |
Throws
assertNotEqual (val1, val2)
Checks if the values passed as arguments are not equal.
Parameters
| Object | val1 | The value that should be compared to the second argument. |
| Object | val2 | The value that should be compared to the first argument. |
Throws
assertNotNaN (val)
Checks if the value passed as argument is not NaN.
Parameters
| Object | val | The value that should be not NaN. |
Throws
assertNotNull (val)
Checks if the value passed as argument is not null.
Parameters
| Object | val | The value that should be not null. |
Throws
assertNotUndefined (val)
Checks if the value passed as argument is not undefined.
Parameters
| Object | val | The value that should be not undefined. |
Throws
assertNull (val)
Checks if the value passed as argument is null.
Parameters
| Object | val | The value that should be null. |
Throws
assertStringContains (val, str)
Checks if the value passed as argument contains the pattern specified.
Parameters
| String | val | The string that should contain the pattern |
| String | str | The string that should be contained |
Throws
assertThrows (func, exception)
Checks if the function passed as argument throws a defined exception.
Parameters
| Object | func | The function to call |
| Object | exception | Optional object expected to be thrown when executing the function |
Throws
assertTrue (val)
Checks if the value passed as argument is boolean true.
Parameters
| Object | val | The value that should be boolean true. |
Throws
assertUndefined (val)
Checks if the value passed as argument is undefined.
Parameters
| Object | val | The value that should be undefined. |
Throws
jsDump (value, lvl)
Converts the value passed as argument into a nicely formatted and indented string
Parameters
| Object | value | The value to convert into a string |
| Number | lvl | Optional indentation level (defaults to zero) |
Returns
| String | The string representation of the object passed as argument |
run (modulePathOrScope, writer)
The main runner method
Parameters
| String|Object | modulePathOrScope | Either the path to a module containing unit tests to execute, or an object containing the exported test methods or nested scopes. |
| Object | writer | Optional writer to use for displaying the test results. Defaults to TermWriter. |
