API Docs for:
Show:

Hop.TestUtils Class

Defined in: lib/test.js:12
Module: Test
Parent Module: Hop

Holds testing utility functions

All of the functions in this class must be usable with (function).toString() for embedding

Methods

Hop.TestUtils.arrayContains

(
  • array
  • {Object
)
static

Defined in lib/test.js:138

Test to ensure that the array contains the specified value

This function is designed to be usable with (function).toString() for embedding

Parameters:

  • array Object

    The output array

  • {Object Object

    value The expected object value

Returns:

bool

Hop.TestUtils.clearValues

() static

Defined in lib/test.js:184

Clears all saved values, this is called at the completion of a test case

Hop.TestUtils.extendTo

() static

Defined in lib/test.js:291

Utility function to copy an object, primarly used by .with

Hop.TestUtils.getProperty

(
  • object
  • property
)
static

Defined in lib/test.js:273

Return the value of the named property in the object

The property name may be in dotted form

Parameters:

  • object Object
  • property String

Hop.TestUtils.inputSameAsOutput

(
  • output
  • propertyName
  • [propertyValue]
)
static

Defined in lib/test.js:95

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:

  • output Object

    The output object

  • propertyName String

    The property to test (supports dotted notation)

  • [propertyValue] Object optional

    The expected object value

Returns:

bool

Hop.TestUtils.loadValue

() static

Defined in lib/test.js:169

Loads a value for later usage as part of a test

Hop.TestUtils.objectCovers

(
  • input
  • output
)
static

Defined in lib/test.js:21

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:

  • input Object

    The input object

  • output Object

    The output object

Hop.TestUtils.resolve

() static

Defined in lib/test.js:208

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

Defined in lib/test.js:195

Saves a value for later usage as part of a test