API Docs for:
Show:

Hop.TestTask Class

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

Used to impelement the .do interface for defineTest

so .do("MyClass.myFunc") is implemented by this class

Constructor

Hop.TestTask

(
  • funcName
)

Defined in lib/test.js:358

Parameters:

  • funcName String

    The name of the function this test should call

Methods

errorContains

(
  • value
)
chainable

Defined in lib/test.js:522

Insure the error contains a specific string

This will also test to insure the output is null

Parameters:

  • value String

    The string to insure the error contains

inputSameAsOutput

() chainable

Defined in lib/test.js:462

Require that the input object is contained within the output object

This will test to insure that the output object minially contains all the same parameters as the input object

noError

() chainable

Defined in lib/test.js:430

Require that the function does not return an error

This will not test the result in anyway, since having both a null error and null result is acceptable

outputArrayContains

() chainable

Defined in lib/test.js:605

Test the output array contains

outputContains

(
  • value
)
chainable

Defined in lib/test.js:505

Test to insure that the output contains a specific object

This test will insure that the output is a superset of the specified object

Parameters:

  • value Object

    The object to compare the output to

outputHasProperty

(
  • property
)
chainable

Defined in lib/test.js:539

Insure that the output has a specified property

This will test for existence of a specific property

Parameters:

  • property String

    The name of the property

outputIsArray

() chainable

Defined in lib/test.js:592

Test the output to make sure it is an array

outputIsArrayWithLength

(
  • length
)
chainable

Defined in lib/test.js:577

Test the output to make sure it an array with a specified length

Parameters:

  • length String

    The length of the array

outputIsNull

() chainable

Defined in lib/test.js:477

Test to insure the output is null

outputNotNull

() chainable

Defined in lib/test.js:490

Test to insure the output is not null

This test will also insure that the error is null

outputPropertyChanged

(
  • value
)
chainable

Defined in lib/test.js:445

Require that the specified property has been changed from what was in the input

This test will also insure that the error is null and that the result is not null

Parameters:

  • value String

    The name of the property in the output

outputSameAs

(
  • savedValue
)
chainable

Defined in lib/test.js:557

Test the output to make sure it is the same as the specified object or saved object

Parameters:

  • savedValue String

    The name of the saved result

Example:

Test.do("User.save").with(user).outputSameAs({ name:'foo', email:'bar@bar.com'});
Test.do("User.save").with(user).outputSameAs("#{savedUser}");
Test.do("User.save").with(user).outputSameAs("#{savedUsers[1]}");

saveOutputAs

(
  • name
)
chainable

Defined in lib/test.js:415

Save the output into a name variable for usage later

Parameters:

  • name String

    The name of the value to save

with

(
  • inputValue
  • extend
)
chainable

Defined in lib/test.js:378

Defines the input to be used for the API call

This may either be a JavaScript Object or a named value (as created by .saveOutputAs)

Parameters:

  • inputValue Mixed

    The input value to use. Can be an object or string

  • extend Object

    The object to extend the input value with. Can be an object or string

Example:

test.do("Object.method").with({a:1, b:2});
test.do("Object.method").with("savedValue");
test.do("Object.method").with("savedValue",{a: 6} );