API Docs for: 0.1.0

Class gabarito.Assert

Class defined in: lib/gabarito.js:25

The Assert class provides the various assertions used within tests.

gabarito.Assert( [parts] )
lib/gabarito.js:25
Parameters:
  • [parts] <Parts::Parts>

Index

Methods

areEqual( a, b )
lib/gabarito.js:81

Asserts that both values are equal (using parts.Parts/equals method).

Parameters:
  • a <Mixed>

    A value

  • b <Mixed>

    A another value

areEqual( a, b, equality )
lib/gabarito.js:92

Asserts that both values are equals by using the passed equality function.

The equality function will receive both values as arguments and it must returns true if the values are considered equal.

Parameters:
  • a <Mixed>

    A value

  • b <Mixed>

    Another value

  • equality <Function>

    The equality function

areEqual( a, b, msg )
lib/gabarito.js:107

Asserts that both values are equal (using parts.Parts/equals method).

Parameters:
  • a <Mixed>

    A value

  • b <Mixed>

    Another value

  • msg <String>

    The error message

areEqual( a, b, equality, msg )
lib/gabarito.js:119

Asserts that both values are equals by using the passed equality function.

The equality function will receive both values as arguments and it must returns true if the values are considered equal.

Parameters:
  • a <Mixed>

    A value

  • b <Mixed>

    Another value

  • equality <Function>

    The equality function

  • msg <String>

    The error message

areNotSame( a, b )
lib/gabarito.js:69

Asserts that both values are not the same (using !==)

Parameters:
  • a <Mixed>

    A value

  • b <Mixed>

    Another value

areSame( a, b )
lib/gabarito.js:56

Asserts that both values are the same (using ===)

Parameters:
  • a <Mixed>

    A value

  • b <Mixed>

    Another value

dhop( o, p, [msg] )
lib/gabarito.js:392

Asserts that a given object doesn't own a property

Parameters:
  • o <Object>

    The object

  • p <String>

    The property name

  • [msg] <String>

    The error message

doesntHasProperty( o, p, [msg] )
lib/gabarito.js:363

Asserts that a given object doesn't has a property

Parameters:
  • o <Object>

    The object

  • p <String>

    The property name

  • [msg] <String>

    The error message

hasProperty( o, p, [msg] )
lib/gabarito.js:350

Asserts that a given object has a property

Parameters:
  • o <Object>

    The object

  • p <String>

    The property name

  • [msg] <String>

    The error message

hop( o, p, [msg] )
lib/gabarito.js:376

Asserts that a given object owns a property

Parameters:
  • o <Object>

    The object

  • p <String>

    The property name

  • [msg] <String>

    The error message

isArray( v, [msg] )
lib/gabarito.js:149

Asserts that a given value is an array.

Parameters:
  • v <Mixed>

    Value

  • [msg] <String>

    The error message

isBoolean( v, [msg] )
lib/gabarito.js:160

Asserts that a given value is a boolean.

Parameters:
  • v <Mixed>

    Value

  • [msg] <String>

    The error message

isDate( v, [msg] )
lib/gabarito.js:228

Asserts that a given value is a Date instance.

Parameters:
  • v <Mixed>

    Value

  • [msg] <String>

    The error message

isFalse( v, [msg] )
lib/gabarito.js:252

Asserts that a given value is false.

Parameters:
  • v <Mixed>

    Value

  • [msg] <String>

    The error message

isFunction( v, [msg] )
lib/gabarito.js:171

Asserts that a given value is a function.

Parameters:
  • v <Mixed>

    Value

  • [msg] <String>

    The error message

isInstanceOf( o, t, [msg] )
lib/gabarito.js:239

Asserts that a given value is an instance of a given type.

Parameters:
  • o <Mixed>

    The object

  • t <Function>

    The type

  • [msg] <String>

    The error message

isNaN( v, [msg] )
lib/gabarito.js:274

Asserts that a given value is NaN.

Note that the value should be the actual NaN and not something that converts to NaN.

Parameters:
  • v <Mixed>

    Value

  • [msg] <String>

    The error message

isNotNaN( v, [msg] )
lib/gabarito.js:288

Asserts that a given value is not NaN.

Note that the value should be the actual NaN and not something that converts to NaN.

Parameters:
  • v <Mixed>

    Value

  • [msg] <String>

    The error message

isNotNull( v, [msg] )
lib/gabarito.js:314

Asserts that a given value is not null.

Parameters:
  • v <Mixed>

    Value

  • [msg] <String>

    The error message

isNotUndefined( v, [msg] )
lib/gabarito.js:338

Asserts that a given value is undefined.

Parameters:
  • v <Mixed>

    Value

  • [msg] <String>

    The error message

isNull( v, [msg] )
lib/gabarito.js:303

Asserts that a given value is null.

Parameters:
  • v <Mixed>

    Value

  • [msg] <String>

    The error message

isNumber( v, [msg] )
lib/gabarito.js:183

Asserts that a given value is a number and is not NaN.

Parameters:
  • v <Mixed>

    Value

  • [msg] <String>

    The error message

isObject( v, [msg] )
lib/gabarito.js:194

Asserts that a given value is an object.

Parameters:
  • v <Mixed>

    Value

  • [msg] <String>

    The error message

isRegExp( v, [msg] )
lib/gabarito.js:216

Asserts that a given value is a RegExp instance.

Parameters:
  • v <Mixed>

    Value

  • [msg] <String>

    The error message

isString( v, [msg] )
lib/gabarito.js:205

Asserts that a given value is a string.

Parameters:
  • v <Mixed>

    Value

  • [msg] <String>

    The error message

isTrue( v, [msg] )
lib/gabarito.js:263

Asserts that a given value is true.

Parameters:
  • v <Mixed>

    Value

  • [msg] <String>

    The error message

isUndefined( v, [msg] )
lib/gabarito.js:326

Asserts that a given value is undefined.

Parameters:
  • v <Mixed>

    Value

  • [msg] <String>

    The error message

gabarito.AssertThat that( value )
lib/gabarito.js:408

A nice helper to use asserts in a more expressive way. It has all the methods from the assert itself.

Usage:

assert.that(someValue).isEqualTo("3");
Parameters:
  • value <Mixed>