Hop.TestUtils Class
Holds testing utility functions
All of the functions in this class must be usable with (function).toString() for embedding
Item Index
Methods
- Hop.TestUtils.arrayContains static
- Hop.TestUtils.clearValues static
- Hop.TestUtils.extendTo static
- Hop.TestUtils.getProperty static
- Hop.TestUtils.inputSameAsOutput static
- Hop.TestUtils.loadValue static
- Hop.TestUtils.objectCovers static
- Hop.TestUtils.resolve static
- Hop.TestUtils.saveValue static
Methods
Hop.TestUtils.arrayContains
-
array -
{Object
Test to ensure that the array contains the specified value
This function is designed to be usable with (function).toString() for embedding
Parameters:
-
arrayObjectThe output array
-
{ObjectObjectvalue The expected object value
Returns:
Hop.TestUtils.clearValues
()
static
Clears all saved values, this is called at the completion of a test case
Hop.TestUtils.extendTo
()
static
Utility function to copy an object, primarly used by .with
Hop.TestUtils.getProperty
-
object -
property
Return the value of the named property in the object
The property name may be in dotted form
Parameters:
-
objectObject -
propertyString
Hop.TestUtils.inputSameAsOutput
-
output -
propertyName -
[propertyValue]
Test to ensure that the output object has a specific property with a specific value
This function is designed to be usable with (function).toString() for embedding
Parameters:
-
outputObjectThe output object
-
propertyNameStringThe property to test (supports dotted notation)
-
[propertyValue]Object optionalThe expected object value
Returns:
Hop.TestUtils.loadValue
()
static
Loads a value for later usage as part of a test
Hop.TestUtils.objectCovers
-
input -
output
Test to insure that all the input object properties are the same as the output object properties
- The output object may have more properties then are in the input object
- The output object must have all of the same properties, with the same value as the input object
This function is designed to be usable with (function).toString() for embedding
Parameters:
-
inputObjectThe input object
-
outputObjectThe output object
Hop.TestUtils.resolve
()
static
Resolve a values within an array or object based upon saved values
This function will search for strings matching #{.+#} and replace
the object property or array value with the resolved value from a saved value.
Values are resolved like so:
Example:
with(savedValues){
return eval(inputString);
}
Hop.TestUtils.saveValue
()
static
Saves a value for later usage as part of a test
