Methods

static

eq(o1, o2)

Assert two objects are equal

Example

// Check that an input element is set to 42
assert.eq(b.getValue("#input1"), "42");

Parameters

Name Type Optional Description

o1

Object

 

o2

Object

 

Throws

Throws an assertion when o1 is not equal o2

static

equal(o1, o2)

Assert two objects are equal

Example

// Check that an input element is set to 42
assert.equal(b.getValue("#input1"), "42");

Parameters

Name Type Optional Description

o1

Object

 

o2

Object

 

Throws

Throws an assertion when o1 is not equal o2

static

fail([message])

Always fail by throwing an exception

Example

if (!myCriticalCheck()) {
    assert.fail("myCriticalCheck failed");
}

Parameter

Name Type Optional Description

message

String

Yes

the message to report as part of the exception

Throws

Throws an assertion always

static

ne(o1, o2)

Assert the two objects are not equal

Example

// Check that an input element is not set to 42
assert.ne(b.getValue("#input1"), "42");

Parameters

Name Type Optional Description

o1

Object

 

o2

Object

 

Throws

Throws an assertion when o1 is equal o2

static

notEqual(o1, o2)

Assert two objects are not equal

Example

// Check that an input element is not set to 42
assert.notEqual(b.getValue("#input1"), "42");

Parameters

Name Type Optional Description

o1

Object

 

o2

Object

 

Throws

Throws an assertion when o1 is equal o2

static

ok(object)

Assert the given object evaluates to true.

Examples

// This will succeed every time
assert.ok(true);
// This will throw an exception every time
assert.ok(false);

Parameter

Name Type Optional Description

object

Object

 

the object to check

Throws

Throws an assertion when check fails