Unit.js provide several helpers methods. Helpers do not make assertions.
See also the guide of "helpers" for more details and examples.
Members
-
static stats :Object
-
Stats, see also stats in the guide.
Methods
-
case(expression)
-
It does nothing, is just pass-through method for a fluent chain. If a function is passed, it is called.
this
scope is a reference totest.$di._container
.See also case() in the guide.
ParametersName Type Argument Description expression mixedoptional repeatable Zero, one or more arguments.
ReturnsType Description ObjectThe current UnitJS instance
See also -
given(expression)
-
It does nothing, is just pass-through method for a fluent chain. If a function is passed, it is called.
this
scope is a reference totest.$di._container
.See also given() in the guide.
ParametersName Type Argument Description expression mixedoptional repeatable Zero, one or more arguments.
ReturnsType Description ObjectThe current UnitJS instance
See also -
when(expression)
-
It does nothing, is just pass-through method for a fluent chain. If a function is passed, it is called.
this
scope is a reference totest.$di._container
.See also when() in the guide.
ParametersName Type Argument Description expression mixedoptional repeatable Zero, one or more arguments.
ReturnsType Description ObjectThe current UnitJS instance
See also -
then(expression)
-
It does nothing, is just pass-through method for a fluent chain. If a function is passed, it is called.
this
scope is a reference totest.$di._container
.See also then() in the guide.
ParametersName Type Argument Description expression mixedoptional repeatable Zero, one or more arguments.
ReturnsType Description ObjectThe current UnitJS instance
See also -
if(expression)
-
It does nothing, is just pass-through method for a fluent chain.
this
scope is a reference totest.$di._container
.See also if() in the guide.
ParametersName Type Argument Description expression mixedoptional repeatable Zero, one or more arguments.
ReturnsType Description ObjectThe current UnitJS instance
See also -
and(expression)
-
It does nothing, is just pass-through method for a fluent chain.
this
scope is a reference totest.$di._container
.See also and() in the guide.
ParametersName Type Argument Description expression mixedoptional repeatable Zero, one or more arguments.
ReturnsType Description ObjectThe current UnitJS instance
See also -
wait(ms, fn)
-
Execute the given function after a specified number of milliseconds.
this
scope is a reference totest.$di._container
.See also in the guide:
ParametersName Type Description ms numberThe number of milliseconds to wait before executing the code.
fn functionThe function that will be executed.
ReturnsType Description ObjectThe current UnitJS instance.
-
dump(value)
-
Dump the arguments. If no argument is passed, the actual tested value is dumped.
See also dump() in the guide.
ParametersName Type Argument Description value mixedoptional repeatable Zero, one or more values to output. The string representations of each of these objects are appended together in the order listed and output.
ReturnsType Description ObjectThe current control flow of unit testing.
-
fail(message, expected, actual, inspect)
-
Fails a test. See also fail() in the guide.
ParametersName Type Argument Description message stringoptional Error message.
expected mixedoptional Expected value.
actual mixedoptional Actual value, by default the last value tested is used.
inspect mixedoptional repeatable Zero, one or more arguments to inspect in the console with the helper test.dump().
ThrowsType Description AssertionErrorThrows an
AssertionError
with the given arguments passed to the methodfail()
.