Class: It

'brixy.tester.It'~ It

new It (job, comparisonDepthopt)

It object.

Parameters:
Name Type Attributes Default Description
job module:'brixy.tester.Job'~Job

Reference to the job instance.

comparisonDepth int <optional>
10

Nesting level of the comparison of the objects.

Source:

Methods

addSpecialType (Type, valueCallback, captionCallback)

Adds new special type definition. Methods isLike() and notLike() compares own properties of tested objects. Special types allows to define own values to be used in testing.

Parameters:
Name Type Description
Type function

Object's constructor.

valueCallback function

function(val){ return val.something; } returns a value for testing.

captionCallback function

function(val){ return val.toString(); } returns a string to show in report dialog.

Example:
// Before using a special type definition:
// test passed because Date doesn't have own properties,
// but dates are different
it.isLike('', new Date(), new Date(1000));

// Let's define Date as a special type:
it.addSpecialType(
	Date, 
	function(val) { return val.getTime(); }, 
	function(val) { return 'Date("' + val.toLocaleString() + '")'; }
);
it.notLike('', new Date(), new Date(1000));
it.isLike('', new Date(1000), new Date(1000));
// and that we wished
Source:

addSpecialTypeDef (def)

Adds new special type definition.

Parameters:
Name Type Description
def Object

{constr: Type, value: Function, caption: Function}

Throws:
  • Exception

Source:

is (name, actual, expected)

Tests if values are identical.

Parameters:
Name Type Description
name string
actual *
expected *
Source:

isLike (name, actual, expected, depthopt)

Tests if values are equal.

Parameters:
Name Type Attributes Default Description
name string
actual *
expected *
depth int <optional>
10

Nesting level of the comparison of the objects.

Source:

isMember (name, actual, expected)

Tests if actual value is member of the expected value.

Parameters:
Name Type Description
name string
actual *
expected *
Source:

isNot (name, actual, expected)

Tests if values are not identical.

Parameters:
Name Type Description
name string
actual *
expected *
Source:

isThrown (name, actual, expectedopt)

Tests if actual function throws exception.

Parameters:
Name Type Attributes Description
name string
actual function
expected * <optional>
Source:

notLike (name, actual, expected, depthopt)

Tests if values are not equal.

Parameters:
Name Type Attributes Default Description
name string
actual *
expected *
depth int <optional>
10

Nesting level of the comparison of the objects.

Source:

notMember (name, actual, expected)

Tests if actual value is not member of the expected value.

Parameters:
Name Type Description
name string
actual *
expected *
Source:

notThrown (name, actual, expectedopt)

Tests if actual function doesn't throw exception.

Parameters:
Name Type Attributes Description
name string
actual function
expected * <optional>
Source:

toString () → {string}

Returns a string representation of the object.

Returns:
  • string
Source: