new BaseTestSuite() → {rooibos.BaseTestSuite}
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++ base methods to override +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Properties:
Name | Type | Description |
---|---|---|
name |
string
|
test state |
filePath |
invalid
|
set the name to the name of your test |
pkgPath |
invalid
|
|
isValid |
boolean
|
|
hasSoloTests |
boolean
|
|
hasIgnoredTests |
boolean
|
|
isSolo |
boolean
|
|
isIgnored |
boolean
|
|
noCatch |
boolean
|
|
isNodeTest |
boolean
|
|
nodeName |
invalid
|
|
lineNumber |
integer
|
|
groups |
dynamic
|
|
groupsData |
dynamic
|
|
stats |
invalid
|
|
currentAssertLineNumber |
dynamic
|
|
valid |
boolean
|
|
hasFailures |
boolean
|
|
hasSoloGroups |
boolean
|
|
isFailingFast |
boolean
|
|
stubs |
invalid
|
|
mocks |
invalid
|
|
__stubId |
dynamic
|
|
__mockId |
dynamic
|
|
__mockTargetId |
dynamic
|
|
currentExecutionTime |
integer
|
|
timedOut |
boolean
|
|
deferred |
invalid
|
|
invalidValue |
string
|
special values |
ignoreValue |
string
|
special value used in mock arguments |
anyStringMatcher |
dynamic
|
built in any matchers |
anyBoolMatcher |
dynamic
|
|
anyNumberMatcher |
dynamic
|
|
anyAAMatcher |
dynamic
|
|
anyArrayMatcher |
dynamic
|
|
anyNodeMatcher |
dynamic
|
|
allowNonExistingMethodsOnMocks |
boolean
|
|
isAutoAssertingMocks |
boolean
|
|
currentResult |
invalid
|
|
global |
invalid
|
|
catchCrashes |
boolean
|
|
throwOnFailedAssertion |
boolean
|
- Source:
Returns:
- Type:
-
rooibos.BaseTestSuite
Methods
assertAAContainsSubset(array, subset, ignoredFieldsopt, msgopt) → {dynamic}
Asserts the associative array contains the fields contained in subset; while ignoring the fields in the ignoredFields array
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
array |
assocarray
|
associative array to check |
||
subset |
assocarray
|
associative array of values to check for |
||
ignoredFields |
array
|
<optional> |
invalid |
array of fieldnames to ignore while comparing |
msg |
string
|
<optional> |
"" |
alternate error message |
Returns:
- Type:
-
dynamic
- true if the assert was satisfied, false otherwise
assertAAHasKey(aa, key, msgopt) → {dynamic}
Fail if the aa doesn't have the key.
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
aa |
Dynamic
|
target aa |
||
key |
Dynamic
|
key name |
||
msg |
Dynamic
|
<optional> |
"" |
alternate error message |
Returns:
- Type:
-
dynamic
- true if the assert was satisfied, false otherwise
assertAAHasKeys(aa, keys, msgopt) → {dynamic}
Fail if the aa doesn't have the keys list.
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
aa |
Dynamic
|
A target associative array. |
||
keys |
Dynamic
|
Array of key names. |
||
msg |
Dynamic
|
<optional> |
"" |
alternate error message |
Returns:
- Type:
-
dynamic
- true if the assert was satisfied, false otherwise
assertAANotHasKey(aa, key, msgopt) → {dynamic}
Fail if the aa has the key.
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
aa |
Dynamic
|
target aa |
||
key |
Dynamic
|
key name |
||
msg |
Dynamic
|
<optional> |
"" |
alternate error message |
Returns:
- Type:
-
dynamic
- true if the assert was satisfied, false otherwise
assertAANotHasKeys(aa, keys, msgopt) → {dynamic}
Fail if the aa has the keys list.
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
aa |
Dynamic
|
A target associative array. |
||
keys |
Dynamic
|
Array of key names. |
||
msg |
Dynamic
|
<optional> |
"" |
alternate error message |
Returns:
- Type:
-
dynamic
- true if the assert was satisfied, false otherwise
assertArrayContains(array, value, keyopt, msgopt) → {dynamic}
Fail if the array doesn't have the item.
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
array |
Dynamic
|
target array |
||
value |
Dynamic
|
value to check - value to check for |
||
key |
Dynamic
|
<optional> |
invalid |
key name in associative array |
msg |
Dynamic
|
<optional> |
"" |
alternate error message |
Returns:
- Type:
-
dynamic
- true if the assert was satisfied, false otherwise
assertArrayContainsAAs(array, values, msgopt) → {dynamic}
Fail if the array does not contain all of the aa's in the values array.
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
array |
Dynamic
|
target array |
||
values |
Dynamic
|
array of aas to look for in target array |
||
msg |
Dynamic
|
<optional> |
"" |
alternate error message |
Returns:
- Type:
-
dynamic
- true if the assert was satisfied, false otherwise
assertArrayContainsOnlyValuesOfType(array, typeStr, msgopt) → {dynamic}
Fail if the array doesn't contains items of specific type only.
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
array |
Dynamic
|
target array |
||
typeStr |
Dynamic
|
type name - must be String, Array, Boolean, or AssociativeArray |
||
msg |
Dynamic
|
<optional> |
"" |
alternate error message |
Returns:
- Type:
-
dynamic
- true if the assert was satisfied, false otherwise
assertArrayContainsSubset(array, subset, msgopt) → {dynamic}
Fail if the array doesn't have the item subset.
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
array |
Dynamic
|
target array |
||
subset |
Dynamic
|
items to check presence of |
||
msg |
Dynamic
|
<optional> |
"" |
alternate error message |
Returns:
- Type:
-
dynamic
- true if the assert was satisfied, false otherwise
assertArrayCount(array, count, msgopt) → {dynamic}
Fail if the array items count <> expected count
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
array |
Dynamic
|
target array |
||
count |
Dynamic
|
An expected array items count |
||
msg |
Dynamic
|
<optional> |
"" |
alternate error message |
Returns:
- Type:
-
dynamic
- true if the assert was satisfied, false otherwise
assertArrayNotContains(array, value, keyopt, msgopt) → {dynamic}
Fail if the array has the item.
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
array |
Dynamic
|
target array |
||
value |
Dynamic
|
value to check - Value to check for |
||
key |
Dynamic
|
<optional> |
invalid |
A key name for associative array. |
msg |
Dynamic
|
<optional> |
"" |
alternate error message |
Returns:
- Type:
-
dynamic
- true if the assert was satisfied, false otherwise
assertArrayNotContainsSubset(array, subset, msgopt) → {dynamic}
Fail if the array have the item from subset.
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
array |
Dynamic
|
target array |
||
subset |
Dynamic
|
items to check presence of |
||
msg |
Dynamic
|
<optional> |
"" |
alternate error message |
Returns:
- Type:
-
dynamic
- true if the assert was satisfied, false otherwise
assertArrayNotCount(array, count, msgopt) → {dynamic}
Fail if the array items count = expected count.
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
array |
Dynamic
|
target array |
||
count |
Dynamic
|
An expected array items count. |
||
msg |
Dynamic
|
<optional> |
"" |
alternate error message |
Returns:
- Type:
-
dynamic
- true if the assert was satisfied, false otherwise
assertAsyncField(target, fieldName, delayopt, maxAttemptsopt) → {dynamic}
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
target |
dynamic
|
|||
fieldName |
dynamic
|
|||
delay |
dynamic
|
<optional> |
500 | |
maxAttempts |
dynamic
|
<optional> |
10 |
Returns:
- Type:
-
dynamic
assertClass(value, expectedClassName, msgopt) → {dynamic}
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
value |
dynamic
|
|||
expectedClassName |
dynamic
|
|||
msg |
dynamic
|
<optional> |
"" |
Returns:
- Type:
-
dynamic
assertEmpty(item, msgopt) → {dynamic}
Fail if the item is not empty array or string.
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
item |
Dynamic
|
item to check |
||
msg |
Dynamic
|
<optional> |
"" |
alternate error message |
Returns:
- Type:
-
dynamic
- true if the assert was satisfied, false otherwise
assertEqual(first, second, msgopt) → {dynamic}
Fail if the two objects are unequal as determined by the '<>' operator.
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
first |
Dynamic
|
first object to compare |
||
second |
Dynamic
|
second object to compare |
||
msg |
Dynamic
|
<optional> |
"" |
alternate error message |
Returns:
- Type:
-
dynamic
- true if the assert was satisfied, false otherwise
assertFalse(expr, msgopt) → {dynamic}
Fail the test if the expression is true.
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
expr |
Dynamic
|
An expression to evaluate. |
||
msg |
Dynamic
|
<optional> |
"" |
alternate error message |
Returns:
- Type:
-
dynamic
- true if the assert was satisfied, false otherwise
assertInvalid(value, msgopt) → {dynamic}
Fail if the value is not invalid.
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
value |
Dynamic
|
value to check - value to check for |
||
msg |
Dynamic
|
<optional> |
"" |
alternate error message |
Returns:
- Type:
-
dynamic
- true if the assert was satisfied, false otherwise
assertLike(first, second, msgopt) → {dynamic}
does a fuzzy comparison
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
first |
Dynamic
|
first object to compare |
||
second |
Dynamic
|
second object to compare |
||
msg |
Dynamic
|
<optional> |
"" |
alternate error message |
Returns:
- Type:
-
dynamic
- true if the assert was satisfied, false otherwise
assertMocks() → {void}
Will check all mocks that have been created to ensure they were invoked the expected amount of times, with the expected args.
- Source:
Returns:
- Type:
-
void
assertNodeContains(node, value, msgopt) → {dynamic}
Asserts the node contains the child value
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
node |
Dynamic
|
a node to check |
||
value |
Dynamic
|
value to check - value to look for |
||
msg |
Dynamic
|
<optional> |
"" |
alternate error message |
Returns:
- Type:
-
dynamic
- true if the assert was satisfied, false otherwise
assertNodeContainsFields(node, subset, ignoredFieldsopt, msgopt) → {dynamic}
Fail if the node doesn't have the item subset.
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
node |
Dynamic
|
A target node |
||
subset |
Dynamic
|
items to check |
||
ignoredFields |
dynamic
|
<optional> |
invalid | |
msg |
Dynamic
|
<optional> |
"" |
alternate error message |
Returns:
- Type:
-
dynamic
- true if the assert was satisfied, false otherwise
assertNodeContainsOnly(node, value, msgopt) → {dynamic}
Asserts the node contains only the child value
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
node |
Dynamic
|
a node to check |
||
value |
Dynamic
|
value to check - value to look for |
||
msg |
Dynamic
|
<optional> |
"" |
alternate error message |
Returns:
- Type:
-
dynamic
- true if the assert was satisfied, false otherwise
assertNodeCount(node, count, msgopt) → {dynamic}
Asserts that the node contains the designated number of children
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
node |
Dynamic
|
target node |
||
count |
Dynamic
|
expected number of child items |
||
msg |
Dynamic
|
<optional> |
"" |
alternate error message |
Returns:
- Type:
-
dynamic
- true if the assert w, false otherwise
assertNodeEmpty(node, msgopt) → {dynamic}
Asserts the node has no children
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
node |
Dynamic
|
a node to check |
||
msg |
Dynamic
|
<optional> |
"" |
alternate error message |
Returns:
- Type:
-
dynamic
- true if the assert was satisfied, false otherwise
assertNodeNotContains(node, value, msgopt) → {dynamic}
Fail if the node h item.
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
node |
Dynamic
|
A target node |
||
value |
Dynamic
|
value to check - a node child |
||
msg |
Dynamic
|
<optional> |
"" |
alternate error message |
Returns:
- Type:
-
dynamic
- true if the assert was satisfied, false otherwise
assertNodeNotContainsFields(node, subset, msgopt) → {dynamic}
Fail if the node have the item from subset.
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
node |
Dynamic
|
A target node |
||
subset |
Dynamic
|
the items to check for |
||
msg |
Dynamic
|
<optional> |
"" |
alternate error message |
Returns:
- Type:
-
dynamic
- true if the assert w, false otherwise
assertNodeNotCount(node, count, msgopt) → {dynamic}
Fail if the node items count = expected count.
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
node |
Dynamic
|
A target node |
||
count |
Dynamic
|
Expected item count |
||
msg |
Dynamic
|
<optional> |
"" |
alternate error message |
Returns:
- Type:
-
dynamic
- true if the assert was satisfied, false otherwise
assertNodeNotEmpty(node, msgopt) → {dynamic}
Asserts the node has children
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
node |
Dynamic
|
a node to check |
||
msg |
Dynamic
|
<optional> |
"" |
alternate error message |
Returns:
- Type:
-
dynamic
- true if the assert was satisfied, false otherwise
assertNotEmpty(item, msgopt) → {dynamic}
Fail if the item is empty array or string.
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
item |
Dynamic
|
item to check |
||
msg |
Dynamic
|
<optional> |
"" |
alternate error message |
Returns:
- Type:
-
dynamic
- true if the assert was satisfied, false otherwise
assertNotEqual(first, second, msgopt) → {dynamic}
Fail if the two objects are equal as determined by the '=' operator.
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
first |
Dynamic
|
first object to compare |
||
second |
Dynamic
|
second object to compare |
||
msg |
Dynamic
|
<optional> |
"" |
alternate error message |
Returns:
- Type:
-
dynamic
- true if the assert was satisfied, false otherwise
assertNotInvalid(value, msgopt) → {dynamic}
Fail if the value is invalid.
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
value |
Dynamic
|
value to check - value to check for |
||
msg |
Dynamic
|
<optional> |
"" |
alternate error message |
Returns:
- Type:
-
dynamic
- true if the assert was satisfied, false otherwise
assertSubType(value, typeStr, msgopt) → {dynamic}
Asserts that the value is a node of designated subtype
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
value |
Dynamic
|
value to check - target node |
||
typeStr |
Dynamic
|
type name |
||
msg |
Dynamic
|
<optional> |
"" |
alternate error message |
Returns:
- Type:
-
dynamic
- true if the assert was satisfied, false otherwise
assertTrue(expr, msgopt) → {dynamic}
Fail the test unless the expression is true.
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
expr |
Dynamic
|
An expression to evaluate. |
||
msg |
Dynamic
|
<optional> |
"" |
alternate error message |
Returns:
- Type:
-
dynamic
- true if the assert was satisfied, false otherwise
assertType(value, typeStr, msgopt) → {dynamic}
Asserts that the value is a node of designated type
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
value |
Dynamic
|
value to check - target node |
||
typeStr |
Dynamic
|
type name |
||
msg |
Dynamic
|
<optional> |
"" |
alternate error message |
Returns:
- Type:
-
dynamic
- true if the assert was satisfied, false otherwise
cleanMocks() → {void}
Cleans up all tracking data associated with mocks
- Source:
Returns:
- Type:
-
void
cleanStubs() → {void}
Cleans up all tracking data associated with stubs
- Source:
Returns:
- Type:
-
void
combineFakes(fake, otherFake) → {dynamic}
- Source:
Parameters:
Name | Type | Description |
---|---|---|
fake |
dynamic
|
|
otherFake |
dynamic
|
Returns:
- Type:
-
dynamic
createFake(id, target, methodName, expectedInvocationsopt, expectedArgsopt, returnValueopt) → {object}
Creates a stub to replace a real method with. This is used internally.
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
id |
dynamic
|
|||
target |
Dynamic
|
object on which the method to be stubbed is found |
||
methodName |
Dynamic
|
name of method to stub |
||
expectedInvocations |
Dynamic
|
<optional> |
1 |
number of invocations we expect |
expectedArgs |
Dynamic
|
<optional> |
invalid |
array containing the arguments we expect the method to be invoked with |
returnValue |
Dynamic
|
<optional> |
invalid |
value that the stub method will return when invoked |
Returns:
- Type:
-
object
- stub that was wired into the real method
expect(target, methodName, expectedInvocationsopt, expectedArgsopt, returnValueopt, allowNonExistingMethodsopt) → {object}
Creates a stub to replace a real method with, which the framework will track. If it was invoked the wrong number of times, or with wrong arguments, it will result in test failure
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
target |
Dynamic
|
object on which the method to be stubbed is found |
||
methodName |
Dynamic
|
name of method to stub |
||
expectedInvocations |
Dynamic
|
<optional> |
1 |
number of invocations we expect |
expectedArgs |
Dynamic
|
<optional> |
invalid |
array containing the arguments we expect the method to be invoked with |
returnValue |
Dynamic
|
<optional> |
invalid |
value that the stub method will return when invoked |
allowNonExistingMethods |
boolean
|
<optional> |
false |
if true, then rooibos will only warn if the method did not exist prior to faking |
Returns:
- Type:
-
object
- mock that was wired into the real method
expectCalled(invocation, returnValueopt) → {object}
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
invocation |
dynamic
|
|||
returnValue |
dynamic
|
<optional> |
invalid |
Returns:
- Type:
-
object
expectLastCallToThrowError(error) → {dynamic}
- Source:
Parameters:
Name | Type | Description |
---|---|---|
error |
dynamic
|
Returns:
- Type:
-
dynamic
expectNone(target, methodName, allowNonExistingMethodsopt) → {object}
Creates a stub to replace a real method with, which the framework will track. If it was invoked, it will result in test failure
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
target |
Dynamic
|
object on which the method to be stubbed is found |
||
methodName |
Dynamic
|
name of method to stub |
||
allowNonExistingMethods |
boolean
|
<optional> |
false |
if true, then rooibos will only warn if the method did not exist prior to faking |
Returns:
- Type:
-
object
- mock that was wired into the real method
expectNotCalled(invocation) → {object}
- Source:
Parameters:
Name | Type | Description |
---|---|---|
invocation |
dynamic
|
Returns:
- Type:
-
object
expectOnce(target, methodName, expectedArgsopt, returnValueopt, allowNonExistingMethodsopt) → {object}
Creates a stub to replace a real method with, which the framework will track. If it was invoked the wrong number of times, or with wrong arguments, it will result in test failure
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
target |
Dynamic
|
object on which the method to be stubbed is found |
||
methodName |
Dynamic
|
name of method to stub |
||
expectedArgs |
Dynamic
|
<optional> |
invalid |
array containing the arguments we expect the method to be invoked with |
returnValue |
Dynamic
|
<optional> |
invalid |
value that the stub method will return when invoked |
allowNonExistingMethods |
boolean
|
<optional> |
false |
if true, then rooibos will only warn if the method did not exist prior to faking |
Returns:
- Type:
-
object
- mock that was wired into the real method
expectOnceOrNone(target, methodName, isExpected, expectedArgsopt, returnValueopt, allowNonExistingMethodsopt) → {object}
Toggles between expectOnce and expectNone, to allow for easy paremeterized expect behaviour
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
target |
Dynamic
|
object on which the method to be stubbed is found |
||
methodName |
Dynamic
|
name of method to stub |
||
isExpected |
Dynamic
|
if true, then this is the same as expectOnce, if false, then this is the same as expectNone |
||
expectedArgs |
Dynamic
|
<optional> |
invalid |
array containing the arguments we expect the method to be invoked with |
returnValue |
Dynamic
|
<optional> |
invalid |
value that the stub method will return when invoked |
allowNonExistingMethods |
boolean
|
<optional> |
false |
if true, then rooibos will only warn if the method did not exist prior to faking |
Returns:
- Type:
-
object
- mock that was wired into the real method
fail(msgopt, actualopt, expectedopt, createErroropt) → {dynamic}
Fail immediately, with the given message
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
msg |
Dynamic
|
<optional> |
"Error" |
message to display in the test report |
actual |
string
|
<optional> |
"" | |
expected |
string
|
<optional> |
"" | |
createError |
boolean
|
<optional> |
false |
Returns:
- Type:
-
dynamic
- true if the assert was satisfied, false otherwise
failCrash(error, msgopt) → {dynamic}
Fail immediately, with the given exception
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
error |
Dynamic
|
exception to fail on |
||
msg |
Dynamic
|
<optional> |
"" |
message to display in the test report |
Returns:
- Type:
-
dynamic
- true if failure was set, false if the test is already failed
mock(target, methodName, expectedInvocationsopt, expectedArgsopt, returnValueopt, allowNonExistingMethodsopt) → {object}
Creates a stub to replace a real method with, which the framework will track. If it was invoked the wrong number of times, or with wrong arguments, it will result in test failure
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
target |
Dynamic
|
object on which the method to be stubbed is found |
||
methodName |
Dynamic
|
name of method to stub |
||
expectedInvocations |
Dynamic
|
<optional> |
1 |
number of invocations we expect |
expectedArgs |
Dynamic
|
<optional> |
invalid |
array containing the arguments we expect the method to be invoked with |
returnValue |
Dynamic
|
<optional> |
invalid |
value that the stub method will return when invoked |
allowNonExistingMethods |
boolean
|
<optional> |
false |
if true, then rooibos will only warn if the method did not exist prior to faking |
Returns:
- Type:
-
object
- mock that was wired into the real method
mockFail(lineNumber, methodName, message) → {dynamic}
- Source:
Parameters:
Name | Type | Description |
---|---|---|
lineNumber |
dynamic
|
|
methodName |
dynamic
|
|
message |
dynamic
|
Returns:
- Type:
-
dynamic
stub(target, methodName, returnValueopt, allowNonExistingMethodsopt) → {object}
Creates a stub to replace a real method with
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
target |
Dynamic
|
object on which the method to be stubbed is found |
||
methodName |
Dynamic
|
name of method to stub |
||
returnValue |
Dynamic
|
<optional> |
invalid |
value that the stub method will return when invoked |
allowNonExistingMethods |
boolean
|
<optional> |
false |
if true, then rooibos will only warn if the method did not exist prior to faking |
Returns:
- Type:
-
object
- stub that was wired into the real method
stubCall(invocation, stubOrReturnValueopt, functionNameopt) → {object}
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
invocation |
dynamic
|
|||
stubOrReturnValue |
dynamic
|
<optional> |
invalid | |
functionName |
string
|
<optional> |
"" |
Returns:
- Type:
-
object
wait(delayopt) → {dynamic}
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
delay |
dynamic
|
<optional> |
1 |
Returns:
- Type:
-
dynamic
waitForField(field, max, target, fieldName, delayopt, maxAttemptsopt) → {dynamic}
observeField doesn't work in regular unit tests, so we have to wait for the result. We can use this to wait for a network task, foe example, and pass the result directly to a handler. Note - we wait for the value TO CHANGE - so make sure that will be the case, or you'll get stuck forever :)
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
field |
string
|
to observe |
||
max |
int
|
attempts |
||
target |
any
|
to observe |
||
fieldName |
dynamic
|
|||
delay |
int
|
<optional> |
500 |
for each wait |
maxAttempts |
dynamic
|
<optional> |
10 |
Returns:
- Type:
-
dynamic