Assertion test framework
(require("app/lib/assertions/it"))(description, assertion) → {module:assertions/it~it}
Return function for applying assertion function against subject and tests.
Parameters:
Name | Type | Description |
---|---|---|
description |
string | Description of assertion to run against subject (e.g. "returns result"). |
assertion |
assertion | Assertion function to run against subject with each test provided. |
- Source:
Returns:
- Type
- module:assertions/it~it
- Source:
Methods
(inner) compiledDescription(description, test)
Return description compiled with test data
Parameters:
Name | Type | Description |
---|---|---|
description |
string | Base description |
test |
test |
- Source:
Type Definitions
assertion(test, done)
Test assertion to apply during run.
Parameters:
Name | Type | Description |
---|---|---|
test |
test | |
done |
callback |
- Source:
it(subjectName, subject, tests)
Run tests against subject
Parameters:
Name | Type | Description |
---|---|---|
subjectName |
string | Name of subject on which to apply test |
subject |
Object | function | Subject on which to apply test. |
tests |
Array.<test> | Tests to run against subject |
- Source:
routine(test, done)
Test routine
Parameters:
Name | Type | Description |
---|---|---|
test |
test | |
done |
callback |
- Source:
test
Test
Type:
- Object
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
after |
routine |
<optional> |
Routine to execute against test after run. |
before |
routine |
<optional> |
Routine to execute against test before run. |
context |
function |
<optional> |
Closure within which to run test as context |
error |
string | Error message to expect from test run. | |
params |
Array |
<optional> |
Params to apply against functional subject during test run. |
result |
* |
<optional> |
Result to expect from test run. |
subject |
Object | function |
<optional> |
Subject on which to apply test. |
subjectName |
string |
<optional> |
Name of subject on which to apply test. |
timeout |
number |
<optional> |
Total seconds to allow in execution of test before automatic timeout. |
when |
string |
<optional> |
Description of when the assertion applies. |
- Source: