ObjectSubject

certainty~ ObjectSubject

new ObjectSubject(failureStrategy, value)

Subclass of Subject which provides assertions methods for object types.

Parameters:
Name Type Description
failureStrategy FailureStrategy

The failure strategy to use when an assertion fails.

value object

The value being checked.

Source:

Extends

  • Subject

Methods

doesNotHaveField(fieldName) → {ObjectSubject}

Ensure that the object being tested dows not have a property (either its own or inherited) with the specified field name.

Parameters:
Name Type Description
fieldName string

The name of the property.

Source:
Returns:

this for chaining.

Type
ObjectSubject

doesNotHaveOwnField(fieldName) → {ObjectSubject}

Ensure that the object does not have it's own property with the given field name.

Parameters:
Name Type Description
fieldName string

The name of the property.

Source:
Returns:

this for chaining.

Type
ObjectSubject

hasField(fieldName) → {FieldValue}

Ensure that the object being tested has a property (either its own or inherited) with the specified field name.

Parameters:
Name Type Description
fieldName string

The name of the property.

Source:
Returns:

FieldValue for additional assertions on the field value.

Type
FieldValue

hasOwnField(fieldName) → {FieldValue}

Ensure that the object has a property with the given field name. The property must be one of the object's own properties, not one inherited from a prototype.

Parameters:
Name Type Description
fieldName string

The name of the property.

Source:
Returns:

FieldValue for additional assertions on the field value.

Type
FieldValue

isEmpty() → {ObjectSubject}

Ensure that the object being tested is empty. This only checks for fields on the object, not its prototype.

Source:
Returns:

this for chaining.

Type
ObjectSubject

isNotEmpty() → {ObjectSubject}

Ensure that the object being tested is non-empty. This only checks for fields on the object, not its prototype.

Source:
Returns:

this for chaining.

Type
ObjectSubject