Interface QUnitAssert

Hierarchy

Index

Properties

Methods

Properties

public assert: any

public current_testEnvironment: any

public jsDump: any

Methods

public deepEqual(actual: any, expected: any, message?: string): any

A deep recursive comparison assertion, working on primitive types, arrays, objects, regular expressions, dates and functions.

The deepEqual() assertion can be used just like equal() when comparing the value of objects, such that { key: value } is equal to { key: value }. For non-scalar values, identity will be disregarded by deepEqual.

Parameters

  • actual: any

    Object or Expression being tested

  • expected: any

    Known comparison value

  • message?: string optional

    A short description of the assertion

Returns

any

public equal(actual: any, expected: any, message?: string): any

A non-strict comparison assertion, roughly equivalent to JUnit assertEquals.

The equal assertion uses the simple comparison operator (==) to compare the actual and expected arguments. When they are equal, the assertion passes: any; otherwise, it fails. When it fails, both actual and expected values are displayed in the test result, in addition to a given message.

Parameters

  • actual: any

    Expression being tested

  • expected: any

    Known comparison value

  • message?: string optional

    A short description of the assertion

Returns

any

public notDeepEqual(actual: any, expected: any, message?: string): any

An inverted deep recursive comparison assertion, working on primitive types, arrays, objects, regular expressions, dates and functions.

The notDeepEqual() assertion can be used just like equal() when comparing the value of objects, such that { key: value } is equal to { key: value }. For non-scalar values, identity will be disregarded by notDeepEqual.

Parameters

  • actual: any

    Object or Expression being tested

  • expected: any

    Known comparison value

  • message?: string optional

    A short description of the assertion

Returns

any

public notEqual(actual: any, expected: any, message?: string): any

A non-strict comparison assertion, checking for inequality.

The notEqual assertion uses the simple inverted comparison operator (!=) to compare the actual and expected arguments. When they aren't equal, the assertion passes: any; otherwise, it fails. When it fails, both actual and expected values are displayed in the test result, in addition to a given message.

Parameters

  • actual: any

    Expression being tested

  • expected: any

    Known comparison value

  • message?: string optional

    A short description of the assertion

Returns

any

public notPropEqual(actual: any, expected: any, message?: string): any

Parameters

  • actual: any
  • expected: any
  • message?: string optional

Returns

any

public notStrictEqual(actual: any, expected: any, message?: string): any

A non-strict comparison assertion, checking for inequality.

The notStrictEqual assertion uses the strict inverted comparison operator (!==) to compare the actual and expected arguments. When they aren't equal, the assertion passes: any; otherwise, it fails. When it fails, both actual and expected values are displayed in the test result, in addition to a given message.

Parameters

  • actual: any

    Expression being tested

  • expected: any

    Known comparison value

  • message?: string optional

    A short description of the assertion

Returns

any

public ok(state: any, message?: string): any

A boolean assertion, equivalent to CommonJS’s assert.ok() and JUnit’s assertTrue(). Passes if the first argument is truthy.

The most basic assertion in QUnit, ok() requires just one argument. If the argument evaluates to true, the assertion passes; otherwise, it fails. If a second message argument is provided, it will be displayed in place of the result.

Parameters

  • state: any

    Expression being tested

  • message?: string optional

    A short description of the assertion

Returns

any

public propEqual(actual: any, expected: any, message?: string): any

Parameters

  • actual: any
  • expected: any
  • message?: string optional

Returns

any

public strictEqual(actual: any, expected: any, message?: string): any

A strict type and value comparison assertion.

The strictEqual() assertion provides the most rigid comparison of type and value with the strict equality operator (===)

Parameters

  • actual: any

    Expression being tested

  • expected: any

    Known comparison value

  • message?: string optional

    A short description of the assertion

Returns

any

public throws(block: () => any, expected: any, message?: string): any

Assertion to test if a callback throws an exception when run.

When testing code that is expected to throw an exception based on a specific set of circumstances, use throws() to catch the error object for testing and comparison.

Parameters

  • block: () => any

    Function to execute

  • expected: any

    Error Object to compare

  • message?: string optional

    A short description of the assertion

Returns

any

public throws(block: () => any, message?: string): any

Parameters

  • block: () => any

    Function to execute

  • message?: string optional

    A short description of the assertion

Returns

any