Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

Callable

  • Assert(expression: any, message?: string): void
  • Parameters

    • expression: any

      Expression to test for truthiness.

    • Optional message: string

      Message to display on error.

    Returns void

Index

Properties

Methods

Properties

eventually

eventually: PromisedAssert

Methods

Throw

  • Throw(fn: () => void, message?: string): void
  • Throw(fn: () => void, regExp: RegExp): void
  • Throw(fn: () => void, constructor: ErrorConstructor, message?: string): void
  • Throw(fn: () => void, constructor: ErrorConstructor, regExp: RegExp): void
  • Asserts that fn will throw an error.

    Parameters

    • fn: () => void

      Function that may throw.

        • (): void
        • Returns void

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that function will throw an error with message matching regexp.

    Parameters

    • fn: () => void

      Function that may throw.

        • (): void
        • Returns void

    • regExp: RegExp

      Potential expected message match.

    Returns void

  • Asserts that function will throw an error that is an instance of constructor.

    Parameters

    • fn: () => void

      Function that may throw.

        • (): void
        • Returns void

    • constructor: ErrorConstructor

      Potential expected error constructor.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that function will throw an error that is an instance of constructor and an error with message matching regexp.

    Parameters

    • fn: () => void

      Function that may throw.

        • (): void
        • Returns void

    • constructor: ErrorConstructor

      Potential expected error constructor.

    • regExp: RegExp

    Returns void

approximately

  • approximately(act: number, exp: number, delta: number, message?: string): void
  • Asserts that the target is equal to expected, to within a +/- delta range.

    Parameters

    • act: number
    • exp: number
    • delta: number

      Maximum differenced between values.

    • Optional message: string

      Message to display on error.

    Returns void

becomes

  • Parameters

    • promise: PromiseLike<any>
    • expected: any
    • Optional message: string

    Returns PromiseLike<void>

changes

  • changes<T>(modifier: Function, object: T, property: string, message?: string): void
  • Asserts that a function changes the value of a property.

    Type parameters

    • T

    Parameters

    • modifier: Function

      Function to run.

    • object: T

      Container object.

    • property: string

      Property of object expected to be modified.

    • Optional message: string

      Message to display on error.

    Returns void

closeTo

  • closeTo(actual: number, expected: number, delta: number, message?: string): void
  • Asserts that the target is equal to expected, to within a +/- delta range.

    Parameters

    • actual: number

      Actual value

    • expected: number

      Potential expected value.

    • delta: number

      Maximum differenced between values.

    • Optional message: string

      Message to display on error.

    Returns void

containIgnoreCase

  • containIgnoreCase(val: string, exp: string, msg?: string): void
  • Parameters

    • val: string
    • exp: string
    • Optional msg: string

    Returns void

containIgnoreSpaces

  • containIgnoreSpaces(val: string, exp: string, msg?: string): void
  • Parameters

    • val: string
    • exp: string
    • Optional msg: string

    Returns void

containSubset

  • containSubset(val: any, exp: any, msg?: string): void
  • Parameters

    • val: any
    • exp: any
    • Optional msg: string

    Returns void

containsAllDeepKeys

  • containsAllDeepKeys<T>(object: T, keys: (string | Object)[] | {}, message?: string): void
  • Asserts that object contains all of the keys provided. Since Sets and Maps can have objects as keys you can use this assertion to perform a deep comparison. You can also provide a single object instead of a keys array and its keys will be used as the expected set of keys.

    Type parameters

    • T

    Parameters

    • object: T

      Object to test.

    • keys: (string | Object)[] | {}

      Keys to check

    • Optional message: string

      Message to display on error.

    Returns void

containsAllKeys

  • containsAllKeys<T>(object: T, keys: (string | Object)[] | {}, message?: string): void
  • Asserts that object has all of the keys provided but may have more keys not listed. You can also provide a single object instead of a keys array and its keys will be used as the expected set of keys.

    Type parameters

    • T

    Parameters

    • object: T

      Object to test.

    • keys: (string | Object)[] | {}

      Keys to check

    • Optional message: string

      Message to display on error.

    Returns void

decreases

  • decreases<T>(modifier: Function, object: T, property: string, message?: string): void
  • Asserts that a function decreases an object property.

    Type parameters

    • T

    Parameters

    • modifier: Function

      Function to run.

    • object: T

      Container object.

    • property: string

      Property of object expected to be decreased.

    • Optional message: string

      Message to display on error.

    Returns void

deepEqual

  • deepEqual<T>(actual: T, expected: T, message?: string): void
  • Asserts that actual is deeply equal to expected.

    Type parameters

    • T

    Parameters

    • actual: T

      Actual value.

    • expected: T

      Potential expected value.

    • Optional message: string

      Message to display on error.

    Returns void

deepInclude

  • deepInclude(haystack: string, needle: string, message?: string): void
  • deepInclude<T>(haystack: readonly T[] | ReadonlySet<T> | ReadonlyMap<any, T>, needle: T, message?: string): void
  • deepInclude<T>(haystack: T, needle: T extends WeakSet<any> ? never : Partial<T>, message?: string): void
  • Asserts that haystack includes needle. Deep equality is used.

    deprecated

    Does not have any effect on string. Use {@link Assert#include} instead.

    Parameters

    • haystack: string

      Container string.

    • needle: string

      Potential substring of haystack.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that haystack includes needle. Deep equality is used.

    Type parameters

    • T

    Parameters

    • haystack: readonly T[] | ReadonlySet<T> | ReadonlyMap<any, T>

      Container array, set or map.

    • needle: T

      Potential value contained in haystack.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that haystack does not includes needle.

    Type parameters

    • T

    Parameters

    • haystack: T

      Object.

    • needle: T extends WeakSet<any> ? never : Partial<T>

      Potential subset of the haystack's properties.

    • Optional message: string

      Message to display on error.

    Returns void

deepNestedInclude

  • deepNestedInclude(haystack: any, needle: any, message?: string): void
  • Asserts that ‘haystack’ includes ‘needle’. Can be used to assert the inclusion of a subset of properties in an object while checking for deep equality

    Enables the use of dot- and bracket-notation for referencing nested properties. ‘[]’ and ‘.’ in property names can be escaped using double backslashes.Asserts that ‘haystack’ includes ‘needle’. Can be used to assert the inclusion of a subset of properties in an object. Enables the use of dot- and bracket-notation for referencing nested properties. ‘[]’ and ‘.’ in property names can be escaped using double backslashes.

    Parameters

    • haystack: any
    • needle: any
    • Optional message: string

      Message to display on error.

    Returns void

deepNestedPropertyVal

  • deepNestedPropertyVal<T>(object: T, property: string, value: any, message?: string): void
  • Asserts that object has a property named by property with a value given by value. property can use dot- and bracket-notation for nested reference. Uses a deep equality check.

    Type parameters

    • T

    Parameters

    • object: T

      Object to test.

    • property: string

      Property to test.

    • value: any

      Value to test.

    • Optional message: string

      Message to display on error.

    Returns void

deepOwnInclude

  • deepOwnInclude(haystack: any, needle: any, message?: string): void
  • Asserts that ‘haystack’ includes ‘needle’. Can be used to assert the inclusion of a subset of properties in an object while ignoring inherited properties and checking for deep

    Parameters

    • haystack: any
    • needle: any
    • Optional message: string

      Message to display on error.

    Returns void

deepProperty

  • deepProperty<T>(object: T, property: string, message?: string): void
  • Asserts that object has a property named by property, which can be a string using dot- and bracket-notation for deep reference.

    Type parameters

    • T

    Parameters

    • object: T

      Container object.

    • property: string

      Potential contained property of object.

    • Optional message: string

      Message to display on error.

    Returns void

deepPropertyVal

  • deepPropertyVal<T, V>(object: T, property: string, value: V, message?: string): void
  • Asserts that object has a property named by property, which can be a string using dot- and bracket-notation for deep reference.

    Type parameters

    • T

    • V

    Parameters

    • object: T

      Container object.

    • property: string

      Potential contained property of object.

    • value: V

      Potential expected property value.

    • Optional message: string

      Message to display on error.

    Returns void

deepStrictEqual

  • deepStrictEqual<T>(actual: T, expected: T, message?: string): void
  • Alias to deepEqual

    Type parameters

    • T

    Parameters

    • actual: T

      Actual value.

    • expected: T

      Potential expected value.

    • Optional message: string

      Message to display on error.

    Returns void

doesNotBecome

  • Parameters

    • promise: PromiseLike<any>
    • expected: any
    • Optional message: string

    Returns PromiseLike<void>

doesNotChange

  • doesNotChange<T>(modifier: Function, object: T, property: string, message?: string): void
  • Asserts that a function does not change the value of a property.

    Type parameters

    • T

    Parameters

    • modifier: Function

      Function to run.

    • object: T

      Container object.

    • property: string

      Property of object expected not to be modified.

    • Optional message: string

      Message to display on error.

    Returns void

doesNotDecrease

  • doesNotDecrease<T>(modifier: Function, object: T, property: string, message?: string): void
  • Asserts that a function does not decrease an object property.

    Type parameters

    • T

    Parameters

    • modifier: Function

      Function to run.

    • object: T

      Container object.

    • property: string

      Property of object expected not to be decreased.

    • Optional message: string

      Message to display on error.

    Returns void

doesNotHaveAllDeepKeys

  • doesNotHaveAllDeepKeys<T>(object: T, keys: (string | Object)[] | {}, message?: string): void
  • Asserts that object contains all of the keys provided. Since Sets and Maps can have objects as keys you can use this assertion to perform a deep comparison. You can also provide a single object instead of a keys array and its keys will be used as the expected set of keys.

    Type parameters

    • T

    Parameters

    • object: T

      Object to test.

    • keys: (string | Object)[] | {}

      Keys to check

    • Optional message: string

      Message to display on error.

    Returns void

doesNotHaveAllKeys

  • doesNotHaveAllKeys<T>(object: T, keys: (string | Object)[] | {}, message?: string): void
  • Asserts that object does not have at least one of the keys provided. You can also provide a single object instead of a keys array and its keys will be used as the expected set of keys.

    Type parameters

    • T

    Parameters

    • object: T

      Object to test.

    • keys: (string | Object)[] | {}

      Keys to check

    • Optional message: string

      Message to display on error.

    Returns void

doesNotHaveAnyDeepKeys

  • doesNotHaveAnyDeepKeys<T>(object: T, keys: (string | Object)[] | {}, message?: string): void
  • Asserts that object contains all of the keys provided. Since Sets and Maps can have objects as keys you can use this assertion to perform a deep comparison. You can also provide a single object instead of a keys array and its keys will be used as the expected set of keys.

    Type parameters

    • T

    Parameters

    • object: T

      Object to test.

    • keys: (string | Object)[] | {}

      Keys to check

    • Optional message: string

      Message to display on error.

    Returns void

doesNotHaveAnyKeys

  • doesNotHaveAnyKeys<T>(object: T, keys: (string | Object)[] | {}, message?: string): void
  • Asserts that object has none of the keys provided. You can also provide a single object instead of a keys array and its keys will be used as the expected set of keys.

    Type parameters

    • T

    Parameters

    • object: T

      Object to test.

    • keys: (string | Object)[] | {}

      Keys to check

    • Optional message: string

      Message to display on error.

    Returns void

doesNotIncrease

  • doesNotIncrease<T>(modifier: Function, object: T, property: string, message?: string): void
  • Asserts that a function does not increase an object property.

    Type parameters

    • T

    Parameters

    • modifier: Function

      Function to run.

    • object: T

      Container object.

    • property: string

      Property of object expected not to be increased.

    • Optional message: string

      Message to display on error.

    Returns void

doesNotThrow

  • doesNotThrow(fn: () => void, message?: string): void
  • doesNotThrow(fn: () => void, regExp: RegExp): void
  • doesNotThrow(fn: () => void, constructor: ErrorConstructor, message?: string): void
  • doesNotThrow(fn: () => void, constructor: ErrorConstructor, regExp: RegExp): void
  • Asserts that fn will not throw an error.

    Parameters

    • fn: () => void

      Function that may throw.

        • (): void
        • Returns void

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that function will throw an error with message matching regexp.

    Parameters

    • fn: () => void

      Function that may throw.

        • (): void
        • Returns void

    • regExp: RegExp

      Potential expected message match.

    Returns void

  • Asserts that function will throw an error that is an instance of constructor.

    Parameters

    • fn: () => void

      Function that may throw.

        • (): void
        • Returns void

    • constructor: ErrorConstructor

      Potential expected error constructor.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that function will throw an error that is an instance of constructor and an error with message matching regexp.

    Parameters

    • fn: () => void

      Function that may throw.

        • (): void
        • Returns void

    • constructor: ErrorConstructor

      Potential expected error constructor.

    • regExp: RegExp

    Returns void

endsWith

  • endsWith(val: string, exp: string, msg?: string): void
  • Parameters

    • val: string
    • exp: string
    • Optional msg: string

    Returns void

entriesCount

  • entriesCount(str: string, substr: string, count: number, msg?: string): void
  • Parameters

    • str: string
    • substr: string
    • count: number
    • Optional msg: string

    Returns void

equal

  • equal<T>(actual: T, expected: T, message?: string): void
  • Asserts non-strict equality (==) of actual and expected.

    Type parameters

    • T

    Parameters

    • actual: T

      Actual value.

    • expected: T

      Potential expected value.

    • Optional message: string

      Message to display on error.

    Returns void

equalBytes

  • Compares byte arrays on per-element basis.

    example

    Assert.equalBytes(new Uint8Array(3), [0, 0, 0]); Assert.equalBytes(new Uint8Array(2), '0000');

    Parameters

    • Optional buffer: Uint8Array

      Actual byte buffer

    • Optional bytes: string | ArrayLike<number>

      Expected bytes encoded as a hex string or an array-like object

    • Optional msg: string

      Error message conforming to Chai spec

    Returns void

equalIgnoreCase

  • equalIgnoreCase(val: string, exp: string, msg?: string): void
  • Parameters

    • val: string
    • exp: string
    • Optional msg: string

    Returns void

equalIgnoreSpaces

  • equalIgnoreSpaces(val: string, exp: string, msg?: string): void
  • Parameters

    • val: string
    • exp: string
    • Optional msg: string

    Returns void

exists

  • exists<T>(value: T, message?: string): void
  • Asserts that the target is neither null nor undefined.

    Type parameters

    • T

    Parameters

    • value: T

      Actual value.

    • Optional message: string

      Message to display on error.

    Returns void

extensible

  • extensible<T>(object: T, message?: string): void
  • Asserts that object is extensible (can have new properties added to it).

    Type parameters

    • T

    Parameters

    • object: T

      Actual value.

    • Optional message: string

      Message to display on error.

    Returns void

fail

  • fail(message?: string): never
  • fail<T>(actual: T, expected: T, message?: string, operator?: string): never
  • Throws a failure.

    remarks

    Node.js assert module-compatible.

    Parameters

    • Optional message: string

      Message to display on error.

    Returns never

  • Throws a failure.

    remarks

    Node.js assert module-compatible.

    Type parameters

    • T

    Parameters

    • actual: T

      Actual value.

    • expected: T

      Potential expected value.

    • Optional message: string

      Message to display on error.

    • Optional operator: string

      Comparison operator, if not strict equality.

    Returns never

frozen

  • frozen<T>(object: T, message?: string): void
  • Asserts that object is frozen (cannot have new properties added to it and its existing properties cannot be removed).

    Type parameters

    • T

    Parameters

    • object: T

      Actual value.

    • Optional message: string

      Message to display on error.

    Returns void

hasAllDeepKeys

  • hasAllDeepKeys<T>(object: T, keys: (string | Object)[] | {}, message?: string): void
  • Asserts that object has all and only all of the keys provided. Since Sets and Maps can have objects as keys you can use this assertion to perform a deep comparison. You can also provide a single object instead of a keys array and its keys will be used as the expected set of keys.

    Type parameters

    • T

    Parameters

    • object: T

      Object to test.

    • keys: (string | Object)[] | {}

      Keys to check

    • Optional message: string

      Message to display on error.

    Returns void

hasAllKeys

  • hasAllKeys<T>(object: T, keys: (string | Object)[] | {}, message?: string): void
  • Asserts that object has all and only all of the keys provided. You can also provide a single object instead of a keys array and its keys will be used as the expected set of keys.

    Type parameters

    • T

    Parameters

    • object: T

      Object to test.

    • keys: (string | Object)[] | {}

      Keys to check

    • Optional message: string

      Message to display on error.

    Returns void

hasAnyDeepKeys

  • hasAnyDeepKeys<T>(object: T, keys: (string | Object)[] | {}, message?: string): void
  • Asserts that object has at least one of the keys provided. Since Sets and Maps can have objects as keys you can use this assertion to perform a deep comparison. You can also provide a single object instead of a keys array and its keys will be used as the expected set of keys.

    Type parameters

    • T

    Parameters

    • object: T

      Object to test.

    • keys: (string | Object)[] | {}

      Keys to check

    • Optional message: string

      Message to display on error.

    Returns void

hasAnyKeys

  • hasAnyKeys<T>(object: T, keys: (string | Object)[] | {}, message?: string): void
  • Asserts that object has at least one of the keys provided. You can also provide a single object instead of a keys array and its keys will be used as the expected set of keys.

    Type parameters

    • T

    Parameters

    • object: T

      Object to test.

    • keys: (string | Object)[] | {}

      Keys to check

    • Optional message: string

      Message to display on error.

    Returns void

ifError

  • ifError<T>(object: T, message?: string): void
  • Asserts if value is not a false value, and throws if it is a true value.

    remarks

    This is added to allow for chai to be a drop-in replacement for Node’s assert class.

    Type parameters

    • T

    Parameters

    • object: T

      Actual value.

    • Optional message: string

      Message to display on error.

    Returns void

include

  • include(haystack: string, needle: string, message?: string): void
  • include<T>(haystack: readonly T[] | ReadonlySet<T> | ReadonlyMap<any, T>, needle: T, message?: string): void
  • include<T>(haystack: WeakSet<T>, needle: T, message?: string): void
  • include<T>(haystack: T, needle: Partial<T>, message?: string): void
  • Asserts that haystack includes needle.

    Parameters

    • haystack: string

      Container string.

    • needle: string

      Potential substring of haystack.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that haystack includes needle.

    Type parameters

    • T

    Parameters

    • haystack: readonly T[] | ReadonlySet<T> | ReadonlyMap<any, T>

      Container array, set or map.

    • needle: T

      Potential value contained in haystack.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that haystack includes needle.

    Type parameters

    • T: object

    Parameters

    • haystack: WeakSet<T>

      WeakSet container.

    • needle: T

      Potential value contained in haystack.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that haystack includes needle.

    Type parameters

    • T

    Parameters

    • haystack: T

      Object.

    • needle: Partial<T>

      Potential subset of the haystack's properties.

    • Optional message: string

      Message to display on error.

    Returns void

includeDeepMembers

  • includeDeepMembers<T>(superset: T[], subset: T[], message?: string): void
  • Asserts that subset is included in superset using deep equality checking. Order is not take into account.

    Type parameters

    • T

    Parameters

    • superset: T[]

      Actual set of values.

    • subset: T[]

      Potential contained set of values.

    • Optional message: string

      Message to display on error.

    Returns void

includeDeepOrderedMembers

  • includeDeepOrderedMembers<T>(superset: T[], subset: T[], message?: string): void
  • Asserts that subset is included in superset in the same order beginning with the first element in superset. Uses a deep equality check.

    Type parameters

    • T

    Parameters

    • superset: T[]

      Actual set of values.

    • subset: T[]

      Potential contained set of values.

    • Optional message: string

      Message to display on error.

    Returns void

includeMembers

  • includeMembers<T>(superset: T[], subset: T[], message?: string): void
  • Asserts that subset is included in superset. Order is not take into account.

    Type parameters

    • T

    Parameters

    • superset: T[]

      Actual set of values.

    • subset: T[]

      Potential contained set of values.

    • Optional message: string

      Message to display on error.

    Returns void

includeOrderedMembers

  • includeOrderedMembers<T>(superset: T[], subset: T[], message?: string): void
  • Asserts that subset is included in superset in the same order beginning with the first element in superset. Uses a strict equality check (===).

    Type parameters

    • T

    Parameters

    • superset: T[]

      Actual set of values.

    • subset: T[]

      Potential contained set of values.

    • Optional message: string

      Message to display on error.

    Returns void

increases

  • increases<T>(modifier: Function, object: T, property: string, message?: string): void
  • Asserts that a function increases an object property.

    Type parameters

    • T

    Parameters

    • modifier: Function

      Function to run.

    • object: T

      Container object.

    • property: string

      Property of object expected to be increased.

    • Optional message: string

      Message to display on error.

    Returns void

indexOf

  • indexOf(str: string, substr: string, index: number, msg?: string): void
  • Parameters

    • str: string
    • substr: string
    • index: number
    • Optional msg: string

    Returns void

instanceOf

  • instanceOf<T>(value: T, constructor: Function, message?: string): void
  • Asserts that value is an instance of constructor.

    Type parameters

    • T

    Parameters

    • value: T

      Actual value.

    • constructor: Function

      Potential expected contructor of value.

    • Optional message: string

      Message to display on error.

    Returns void

isAbove

  • isAbove(valueToCheck: number, valueToBeAbove: number, message?: string): void
  • Asserts valueToCheck is strictly greater than (>) valueToBeAbove.

    Parameters

    • valueToCheck: number

      Actual value.

    • valueToBeAbove: number

      Minimum Potential expected value.

    • Optional message: string

      Message to display on error.

    Returns void

isArray

  • isArray<T>(value: T, message?: string): void
  • Asserts that value is an array.

    Type parameters

    • T

    Parameters

    • value: T

      Actual value.

    • Optional message: string

      Message to display on error.

    Returns void

isAtLeast

  • isAtLeast(valueToCheck: number, valueToBeAtLeast: number, message?: string): void
  • Asserts valueToCheck is greater than or equal to (>=) valueToBeAtLeast.

    Parameters

    • valueToCheck: number

      Actual value.

    • valueToBeAtLeast: number

      Minimum Potential expected value.

    • Optional message: string

      Message to display on error.

    Returns void

isAtMost

  • isAtMost(valueToCheck: number, valueToBeAtMost: number, message?: string): void
  • Asserts valueToCheck is less than or equal to (<=) valueToBeAtMost.

    Parameters

    • valueToCheck: number

      Actual value.

    • valueToBeAtMost: number

      Minimum Potential expected value.

    • Optional message: string

      Message to display on error.

    Returns void

isBelow

  • isBelow(valueToCheck: number, valueToBeBelow: number, message?: string): void
  • Asserts valueToCheck is strictly less than (<) valueToBeBelow.

    Parameters

    • valueToCheck: number

      Actual value.

    • valueToBeBelow: number

      Minimum Potential expected value.

    • Optional message: string

      Message to display on error.

    Returns void

isBoolean

  • isBoolean<T>(value: T, message?: string): void
  • Asserts that value is a boolean.

    Type parameters

    • T

    Parameters

    • value: T

      Actual value.

    • Optional message: string

      Message to display on error.

    Returns void

isDefined

  • isDefined<T>(value: T, message?: string): void
  • Asserts that value is not undefined.

    Type parameters

    • T

    Parameters

    • value: T

      Actual value.

    • Optional message: string

      Message to display on error.

    Returns void

isEmpty

  • isEmpty<T>(object: T, message?: string): void
  • Asserts that the target does not contain any values. For arrays and strings, it checks the length property. For Map and Set instances, it checks the size property. For non-function objects, it gets the count of own enumerable string keys.

    Type parameters

    • T

    Parameters

    • object: T

      Actual value.

    • Optional message: string

      Message to display on error.

    Returns void

isExtensible

  • isExtensible<T>(object: T, message?: string): void
  • Asserts that object is extensible (can have new properties added to it).

    Type parameters

    • T

    Parameters

    • object: T

      Actual value.

    • Optional message: string

      Message to display on error.

    Returns void

isFalse

  • isFalse<T>(value: T, message?: string): void
  • Asserts that value is false.

    Type parameters

    • T

    Parameters

    • value: T

      Actual value.

    • Optional message: string

      Message to display on error.

    Returns void

isFinite

  • isFinite<T>(value: T, message?: string): void
  • Asserts that value is a finite number. Unlike .isNumber, this will fail for NaN and Infinity.

    Type parameters

    • T

    Parameters

    • value: T

      Actual value

    • Optional message: string

      Message to display on error.

    Returns void

isFrozen

  • isFrozen<T>(object: T, message?: string): void
  • Asserts that object is frozen (cannot have new properties added to it and its existing properties cannot be removed).

    Type parameters

    • T

    Parameters

    • object: T

      Actual value.

    • Optional message: string

      Message to display on error.

    Returns void

isFulfilled

  • Parameters

    Returns PromiseLike<void>

isFunction

  • isFunction<T>(value: T, message?: string): void
  • Asserts that value is a function.

    Type parameters

    • T

    Parameters

    • value: T

      Actual value.

    • Optional message: string

      Message to display on error.

    Returns void

isNaN

  • isNaN<T>(value: T, message?: string): void
  • Asserts that value is NaN.

    Type parameters

    • T

    Parameters

    • value: T

      Actual value.

    • Optional message: string

      Message to display on error.

    Returns void

isNotArray

  • isNotArray<T>(value: T, message?: string): void
  • Asserts that value is not an array.

    Type parameters

    • T

    Parameters

    • value: T

      Actual value.

    • Optional message: string

      Message to display on error.

    Returns void

isNotBoolean

  • isNotBoolean<T>(value: T, message?: string): void
  • Asserts that value is not a boolean.

    Type parameters

    • T

    Parameters

    • value: T

      Actual value.

    • Optional message: string

      Message to display on error.

    Returns void

isNotEmpty

  • isNotEmpty<T>(object: T, message?: string): void
  • Asserts that the target contains values. For arrays and strings, it checks the length property. For Map and Set instances, it checks the size property. For non-function objects, it gets the count of own enumerable string keys.

    Type parameters

    • T

    Parameters

    • object: T

      Object to test.

    • Optional message: string

      Message to display on error.

    Returns void

isNotExtensible

  • isNotExtensible<T>(object: T, message?: string): void
  • Asserts that object is not extensible.

    Type parameters

    • T

    Parameters

    • object: T

      Actual value.

    • Optional message: string

      Message to display on error.

    Returns void

isNotFalse

  • isNotFalse<T>(value: T, message?: string): void
  • Asserts that value is not false.

    Type parameters

    • T

    Parameters

    • value: T

      Actual value.

    • Optional message: string

      Message to display on error.

    Returns void

isNotFrozen

  • isNotFrozen<T>(object: T, message?: string): void
  • Asserts that object is not frozen (cannot have new properties added to it and its existing properties cannot be removed).

    Type parameters

    • T

    Parameters

    • object: T

      Actual value.

    • Optional message: string

      Message to display on error.

    Returns void

isNotFunction

  • isNotFunction<T>(value: T, message?: string): void
  • Asserts that value is not a function.

    Type parameters

    • T

    Parameters

    • value: T

      Actual value.

    • Optional message: string

      Message to display on error.

    Returns void

isNotNaN

  • isNotNaN<T>(value: T, message?: string): void
  • Asserts that value is not NaN.

    Type parameters

    • T

    Parameters

    • value: T

      Actual value.

    • Optional message: string

      Message to display on error.

    Returns void

isNotNull

  • isNotNull<T>(value: T, message?: string): void
  • Asserts that value is not null.

    Type parameters

    • T

    Parameters

    • value: T

      Actual value.

    • Optional message: string

      Message to display on error.

    Returns void

isNotNumber

  • isNotNumber<T>(value: T, message?: string): void
  • Asserts that value is not a number.

    Type parameters

    • T

    Parameters

    • value: T

      Actual value.

    • Optional message: string

      Message to display on error.

    Returns void

isNotObject

  • isNotObject<T>(value: T, message?: string): void
  • Asserts that value is not an object of type 'Object' (as revealed by Object.prototype.toString).

    Type parameters

    • T

    Parameters

    • value: T

      Actual value.

    • Optional message: string

      Message to display on error.

    Returns void

isNotOk

  • isNotOk<T>(value: T, message?: string): void
  • Asserts that object is falsy.

    Type parameters

    • T

    Parameters

    • value: T
    • Optional message: string

      Message to display on error.

    Returns void

isNotSealed

  • isNotSealed<T>(object: T, message?: string): void
  • Asserts that object is not sealed.

    Type parameters

    • T

    Parameters

    • object: T

      Actual value.

    • Optional message: string

      Message to display on error.

    Returns void

isNotString

  • isNotString<T>(value: T, message?: string): void
  • Asserts that value is not a string.

    Type parameters

    • T

    Parameters

    • value: T

      Actual value.

    • Optional message: string

      Message to display on error.

    Returns void

isNotTrue

  • isNotTrue<T>(value: T, message?: string): void
  • Asserts that value is not true.

    Type parameters

    • T

    Parameters

    • value: T

      Actual value.

    • Optional message: string

      Message to display on error.

    Returns void

isNull

  • isNull<T>(value: T, message?: string): void
  • Asserts that value is null.

    Type parameters

    • T

    Parameters

    • value: T

      Actual value.

    • Optional message: string

      Message to display on error.

    Returns void

isNumber

  • isNumber<T>(value: T, message?: string): void
  • Asserts that value is a number.

    Type parameters

    • T

    Parameters

    • value: T

      Actual value.

    • Optional message: string

      Message to display on error.

    Returns void

isObject

  • isObject<T>(value: T, message?: string): void
  • Asserts that value is an object of type 'Object' (as revealed by Object.prototype.toString).

    remarks

    The assertion does not match subclassed objects.

    Type parameters

    • T

    Parameters

    • value: T

      Actual value.

    • Optional message: string

      Message to display on error.

    Returns void

isOk

  • isOk<T>(value: T, message?: string): void
  • Asserts that object is truthy.

    Type parameters

    • T

    Parameters

    • value: T
    • Optional message: string

      Message to display on error.

    Returns void

isRejected

  • Parameters

    Returns PromiseLike<void>

  • Parameters

    • promise: PromiseLike<any>
    • expected: any
    • Optional message: string

    Returns PromiseLike<void>

  • Parameters

    Returns PromiseLike<void>

isSealed

  • isSealed<T>(object: T, message?: string): void
  • Asserts that object is sealed (can have new properties added to it and its existing properties cannot be removed).

    Type parameters

    • T

    Parameters

    • object: T

      Actual value.

    • Optional message: string

      Message to display on error.

    Returns void

isString

  • isString<T>(value: T, message?: string): void
  • Asserts that value is a string.

    Type parameters

    • T

    Parameters

    • value: T

      Actual value.

    • Optional message: string

      Message to display on error.

    Returns void

isTrue

  • isTrue<T>(value: T, message?: string): void
  • Asserts that value is true.

    Type parameters

    • T

    Parameters

    • value: T

      Actual value.

    • Optional message: string

      Message to display on error.

    Returns void

isUndefined

  • isUndefined<T>(value: T, message?: string): void
  • Asserts that value is undefined.

    Type parameters

    • T

    Parameters

    • value: T

      Actual value.

    • Optional message: string

      Message to display on error.

    Returns void

lengthOf

  • lengthOf<T>(object: T, length: number, message?: string): void
  • Asserts that object has a length property with the expected value.

    Type parameters

    • T: { length?: number }

    Parameters

    • object: T

      Container object.

    • length: number

      Potential expected length of object.

    • Optional message: string

      Message to display on error.

    Returns void

match

  • match(value: string, regexp: RegExp, message?: string): void
  • Asserts that value matches the regular expression regexp.

    Parameters

    • value: string

      Actual value.

    • regexp: RegExp

      Potential match of value.

    • Optional message: string

      Message to display on error.

    Returns void

nestedInclude

  • nestedInclude(haystack: any, needle: any, message?: string): void
  • Asserts that ‘haystack’ includes ‘needle’. Can be used to assert the inclusion of a subset of properties in an object.

    Enables the use of dot- and bracket-notation for referencing nested properties. ‘[]’ and ‘.’ in property names can be escaped using double backslashes.Asserts that ‘haystack’ includes ‘needle’. Can be used to assert the inclusion of a subset of properties in an object. Enables the use of dot- and bracket-notation for referencing nested properties. ‘[]’ and ‘.’ in property names can be escaped using double backslashes.

    Parameters

    • haystack: any
    • needle: any
    • Optional message: string

      Message to display on error.

    Returns void

nestedProperty

  • nestedProperty<T>(object: T, property: string, message?: string): void
  • Asserts that object has a direct or inherited property named by property, which can be a string using dot- and bracket-notation for nested reference.

    Type parameters

    • T

    Parameters

    • object: T

      Object to test.

    • property: string

      Property to test.

    • Optional message: string

      Message to display on error.

    Returns void

nestedPropertyVal

  • nestedPropertyVal<T>(object: T, property: string, value: any, message?: string): void
  • Asserts that object has a property named by property with value given by value. property can use dot- and bracket-notation for nested reference. Uses a strict equality check (===).

    Type parameters

    • T

    Parameters

    • object: T

      Object to test.

    • property: string

      Property to test.

    • value: any

      Value to test.

    • Optional message: string

      Message to display on error.

    Returns void

notContainIgnoreCase

  • notContainIgnoreCase(val: string, exp: string, msg?: string): void
  • Parameters

    • val: string
    • exp: string
    • Optional msg: string

    Returns void

notContainIgnoreSpaces

  • notContainIgnoreSpaces(val: string, exp: string, msg?: string): void
  • Parameters

    • val: string
    • exp: string
    • Optional msg: string

    Returns void

notDeepEqual

  • notDeepEqual<T>(actual: T, expected: T, message?: string): void
  • Asserts that actual is not deeply equal to expected.

    Type parameters

    • T

    Parameters

    • actual: T

      Actual value.

    • expected: T

      Potential expected value.

    • Optional message: string

      Message to display on error.

    Returns void

notDeepInclude

  • notDeepInclude(haystack: string, needle: string, message?: string): void
  • notDeepInclude<T>(haystack: readonly T[] | ReadonlySet<T> | ReadonlyMap<any, T>, needle: T, message?: string): void
  • notDeepInclude<T>(haystack: T, needle: T extends WeakSet<any> ? never : Partial<T>, message?: string): void
  • Asserts that haystack does not includes needle. Deep equality is used.

    deprecated

    Does not have any effect on string. Use {@link Assert#notInclude} instead.

    Parameters

    • haystack: string

      Container string.

    • needle: string

      Potential substring of haystack.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that haystack does not includes needle. Deep equality is used.

    Type parameters

    • T

    Parameters

    • haystack: readonly T[] | ReadonlySet<T> | ReadonlyMap<any, T>

      Container array, set or map.

    • needle: T

      Potential value contained in haystack.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that haystack does not includes needle. Deep equality is used.

    Type parameters

    • T

    Parameters

    • haystack: T

      Object.

    • needle: T extends WeakSet<any> ? never : Partial<T>

      Potential subset of the haystack's properties.

    • Optional message: string

      Message to display on error.

    Returns void

notDeepNestedInclude

  • notDeepNestedInclude(haystack: any, needle: any, message?: string): void
  • Asserts that ‘haystack’ does not include ‘needle’. Can be used to assert the absence of a subset of properties in an object while checking for deep equality.

    Enables the use of dot- and bracket-notation for referencing nested properties. ‘[]’ and ‘.’ in property names can be escaped using double backslashes.Asserts that ‘haystack’ includes ‘needle’. Can be used to assert the inclusion of a subset of properties in an object. Enables the use of dot- and bracket-notation for referencing nested properties. ‘[]’ and ‘.’ in property names can be escaped using double backslashes.

    Parameters

    • haystack: any
    • needle: any
    • Optional message: string

      Message to display on error.

    Returns void

notDeepNestedPropertyVal

  • notDeepNestedPropertyVal<T>(object: T, property: string, value: any, message?: string): void
  • Asserts that object does not have a property named by property with value given by value. property can use dot- and bracket-notation for nested reference. Uses a deep equality check.

    Type parameters

    • T

    Parameters

    • object: T

      Object to test.

    • property: string

      Property to test.

    • value: any

      Value to test.

    • Optional message: string

      Message to display on error.

    Returns void

notDeepOwnInclude

  • notDeepOwnInclude(haystack: any, needle: any, message?: string): void
  • Asserts that ‘haystack’ includes ‘needle’. Can be used to assert the absence of a subset of properties in an object while ignoring inherited properties and checking for deep equality.

    Parameters

    • haystack: any
    • needle: any
    • Optional message: string

      Message to display on error.

    Returns void

notDeepProperty

  • notDeepProperty<T>(object: T, property: string, message?: string): void
  • Asserts that object does not have a property named by property, which can be a string using dot- and bracket-notation for deep reference.

    Type parameters

    • T

    Parameters

    • object: T

      Container object.

    • property: string

      Potential contained property of object.

    • Optional message: string

      Message to display on error.

    Returns void

notDeepPropertyVal

  • notDeepPropertyVal<T, V>(object: T, property: string, value: V, message?: string): void
  • Asserts that object does not have a property named by property, which can be a string using dot- and bracket-notation for deep reference.

    Type parameters

    • T

    • V

    Parameters

    • object: T

      Container object.

    • property: string

      Potential contained property of object.

    • value: V

      Potential expected property value.

    • Optional message: string

      Message to display on error.

    Returns void

notEndsWith

  • notEndsWith(val: string, exp: string, msg?: string): void
  • Parameters

    • val: string
    • exp: string
    • Optional msg: string

    Returns void

notEqual

  • notEqual<T>(actual: T, expected: T, message?: string): void
  • Asserts non-strict inequality (!=) of actual and expected.

    Type parameters

    • T

    Parameters

    • actual: T

      Actual value.

    • expected: T

      Potential expected value.

    • Optional message: string

      Message to display on error.

    Returns void

notEqualIgnoreCase

  • notEqualIgnoreCase(val: string, exp: string, msg?: string): void
  • Parameters

    • val: string
    • exp: string
    • Optional msg: string

    Returns void

notEqualIgnoreSpaces

  • notEqualIgnoreSpaces(val: string, exp: string, msg?: string): void
  • Parameters

    • val: string
    • exp: string
    • Optional msg: string

    Returns void

notExists

  • notExists<T>(value: T, message?: string): void
  • Asserts that the target is either null or undefined.

    Type parameters

    • T

    Parameters

    • value: T

      Actual value.

    • Optional message: string

      Message to display on error.

    Returns void

notExtensible

  • notExtensible<T>(object: T, message?: string): void
  • Asserts that object is not extensible.

    Type parameters

    • T

    Parameters

    • object: T

      Actual value.

    • Optional message: string

      Message to display on error.

    Returns void

notFrozen

  • notFrozen<T>(object: T, message?: string): void
  • Asserts that object is not frozen (cannot have new properties added to it and its existing properties cannot be removed).

    Type parameters

    • T

    Parameters

    • object: T

      Actual value.

    • Optional message: string

      Message to display on error.

    Returns void

notInclude

  • notInclude(haystack: string, needle: string, message?: string): void
  • notInclude<T>(haystack: readonly T[] | ReadonlySet<T> | ReadonlyMap<any, T>, needle: T, message?: string): void
  • notInclude<T>(haystack: WeakSet<T>, needle: T, message?: string): void
  • notInclude<T>(haystack: T, needle: Partial<T>, message?: string): void
  • Asserts that haystack does not includes needle.

    Parameters

    • haystack: string

      Container string.

    • needle: string

      Potential substring of haystack.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that haystack does not includes needle.

    Type parameters

    • T

    Parameters

    • haystack: readonly T[] | ReadonlySet<T> | ReadonlyMap<any, T>

      Container array, set or map.

    • needle: T

      Potential value contained in haystack.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that haystack does not includes needle.

    Type parameters

    • T: object

    Parameters

    • haystack: WeakSet<T>

      WeakSet container.

    • needle: T

      Potential value contained in haystack.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that haystack does not includes needle.

    Type parameters

    • T

    Parameters

    • haystack: T

      Object.

    • needle: Partial<T>

      Potential subset of the haystack's properties.

    • Optional message: string

      Message to display on error.

    Returns void

notIncludeDeepOrderedMembers

  • notIncludeDeepOrderedMembers<T>(superset: T[], subset: T[], message?: string): void
  • Asserts that subset isn’t included in superset in the same order beginning with the first element in superset. Uses a deep equality check.

    Type parameters

    • T

    Parameters

    • superset: T[]

      Actual set of values.

    • subset: T[]

      Potential contained set of values.

    • Optional message: string

      Message to display on error.

    Returns void

notIncludeMembers

  • notIncludeMembers<T>(superset: T[], subset: T[], message?: string): void
  • Asserts that subset isn’t included in superset in any order. Uses a strict equality check (===). Duplicates are ignored.

    Type parameters

    • T

    Parameters

    • superset: T[]

      Actual set of values.

    • subset: T[]

      Potential not contained set of values.

    • Optional message: string

      Message to display on error.

    Returns void

notIncludeOrderedMembers

  • notIncludeOrderedMembers<T>(superset: T[], subset: T[], message?: string): void
  • Asserts that subset isn’t included in superset in the same order beginning with the first element in superset. Uses a strict equality check (===).

    Type parameters

    • T

    Parameters

    • superset: T[]

      Actual set of values.

    • subset: T[]

      Potential contained set of values.

    • Optional message: string

      Message to display on error.

    Returns void

notInstanceOf

  • notInstanceOf<T>(value: T, type: Function, message?: string): void
  • Asserts that value is not an instance of constructor.

    Type parameters

    • T

    Parameters

    • value: T

      Actual value.

    • type: Function
    • Optional message: string

      Message to display on error.

    Returns void

notMatch

  • notMatch(expected: any, regexp: RegExp, message?: string): void
  • Asserts that value does not match the regular expression regexp.

    Parameters

    • expected: any
    • regexp: RegExp

      Potential match of value.

    • Optional message: string

      Message to display on error.

    Returns void

notNestedInclude

  • notNestedInclude(haystack: any, needle: any, message?: string): void
  • Asserts that ‘haystack’ does not include ‘needle’. Can be used to assert the absence of a subset of properties in an object.

    Enables the use of dot- and bracket-notation for referencing nested properties. ‘[]’ and ‘.’ in property names can be escaped using double backslashes.Asserts that ‘haystack’ includes ‘needle’. Can be used to assert the inclusion of a subset of properties in an object. Enables the use of dot- and bracket-notation for referencing nested properties. ‘[]’ and ‘.’ in property names can be escaped using double backslashes.

    Parameters

    • haystack: any
    • needle: any
    • Optional message: string

      Message to display on error.

    Returns void

notNestedProperty

  • notNestedProperty<T>(object: T, property: string, message?: string): void
  • Asserts that object does not have a property named by property, which can be a string using dot- and bracket-notation for nested reference. The property cannot exist on the object nor anywhere in its prototype chain.

    Type parameters

    • T

    Parameters

    • object: T

      Object to test.

    • property: string

      Property to test.

    • Optional message: string

      Message to display on error.

    Returns void

notNestedPropertyVal

  • notNestedPropertyVal<T>(object: T, property: string, value: any, message?: string): void
  • Asserts that object does not have a property named by property with value given by value. property can use dot- and bracket-notation for nested reference. Uses a strict equality check (===).

    Type parameters

    • T

    Parameters

    • object: T

      Object to test.

    • property: string

      Property to test.

    • value: any

      Value to test.

    • Optional message: string

      Message to display on error.

    Returns void

notOk

  • notOk<T>(value: T, message?: string): void
  • Asserts that object is falsy.

    Type parameters

    • T

    Parameters

    • value: T
    • Optional message: string

      Message to display on error.

    Returns void

notOwnInclude

  • notOwnInclude(haystack: any, needle: any, message?: string): void
  • Asserts that ‘haystack’ includes ‘needle’. Can be used to assert the absence of a subset of properties in an object while ignoring inherited properties.

    Parameters

    • haystack: any
    • needle: any
    • Optional message: string

      Message to display on error.

    Returns void

notPalindrome

  • notPalindrome(val: string, msg?: string): void
  • Parameters

    • val: string
    • Optional msg: string

    Returns void

notProperty

  • notProperty<T>(object: T, property: string, message?: string): void
  • Asserts that object has a property named by property.

    Type parameters

    • T

    Parameters

    • object: T

      Container object.

    • property: string

      Potential contained property of object.

    • Optional message: string

      Message to display on error.

    Returns void

notPropertyVal

  • notPropertyVal<T, V>(object: T, property: string, value: V, message?: string): void
  • Asserts that object has a property named by property with value given by value.

    Type parameters

    • T

    • V

    Parameters

    • object: T

      Container object.

    • property: string

      Potential contained property of object.

    • value: V

      Potential expected property value.

    • Optional message: string

      Message to display on error.

    Returns void

notReverseOf

  • notReverseOf(val: string, exp: string, msg?: string): void
  • Parameters

    • val: string
    • exp: string
    • Optional msg: string

    Returns void

notSameDeepOrderedMembers

  • notSameDeepOrderedMembers<T>(set1: T[], set2: T[], message?: string): void
  • Asserts that set1 and set2 don’t have the same members in the same order. Uses a deep equality check.

    Type parameters

    • T

    Parameters

    • set1: T[]

      Actual set of values.

    • set2: T[]

      Potential expected set of values.

    • Optional message: string

      Message to display on error.

    Returns void

notSameOrderedMembers

  • notSameOrderedMembers<T>(set1: T[], set2: T[], message?: string): void
  • Asserts that set1 and set2 don’t have the same members in the same order. Uses a strict equality check (===).

    Type parameters

    • T

    Parameters

    • set1: T[]

      Actual set of values.

    • set2: T[]

      Potential expected set of values.

    • Optional message: string

      Message to display on error.

    Returns void

notSealed

  • notSealed<T>(object: T, message?: string): void
  • Asserts that object is not sealed.

    Type parameters

    • T

    Parameters

    • object: T

      Actual value.

    • Optional message: string

      Message to display on error.

    Returns void

notSingleLine

  • notSingleLine(val: string, msg?: string): void
  • Parameters

    • val: string
    • Optional msg: string

    Returns void

notStartsWith

  • notStartsWith(val: string, exp: string, msg?: string): void
  • Parameters

    • val: string
    • exp: string
    • Optional msg: string

    Returns void

notStrictEqual

  • notStrictEqual<T>(actual: T, expected: T, message?: string): void
  • Asserts strict inequality (!==) of actual and expected.

    Type parameters

    • T

    Parameters

    • actual: T

      Actual value.

    • expected: T

      Potential expected value.

    • Optional message: string

      Message to display on error.

    Returns void

notTypeOf

  • notTypeOf<T>(value: T, name: string, message?: string): void
  • Asserts that value's type is not name, as determined by Object.prototype.toString.

    Type parameters

    • T

    Parameters

    • value: T

      Actual value.

    • name: string

      Potential expected type name of value.

    • Optional message: string

      Message to display on error.

    Returns void

notify

  • Parameters

    Returns PromiseLike<void>

ok

  • ok<T>(value: T, message?: string): void
  • Asserts that object is truthy.

    Type parameters

    • T

    Parameters

    • value: T
    • Optional message: string

      Message to display on error.

    Returns void

oneOf

  • oneOf<T>(inList: T, list: T[], message?: string): void
  • Asserts that non-object, non-array value inList appears in the flat array list.

    Type parameters

    • T

    Parameters

    • inList: T

      Value expected to be in the list.

    • list: T[]

      List of values.

    • Optional message: string

      Message to display on error.

    Returns void

operator

  • Compares two values using operator.

    Parameters

    • val1: OperatorComparable

      Left value during comparison.

    • operator: string

      Comparison operator.

    • val2: OperatorComparable

      Right value during comparison.

    • Optional message: string

      Message to display on error.

    Returns void

ownInclude

  • ownInclude(haystack: any, needle: any, message?: string): void
  • Asserts that ‘haystack’ includes ‘needle’. Can be used to assert the inclusion of a subset of properties in an object while ignoring inherited properties.

    Parameters

    • haystack: any
    • needle: any
    • Optional message: string

      Message to display on error.

    Returns void

palindrome

  • palindrome(val: string, msg?: string): void
  • Parameters

    • val: string
    • Optional msg: string

    Returns void

property

  • property<T>(object: T, property: string, message?: string): void
  • Asserts that object has a property named by property.

    Type parameters

    • T

    Parameters

    • object: T

      Container object.

    • property: string

      Potential contained property of object.

    • Optional message: string

      Message to display on error.

    Returns void

propertyVal

  • propertyVal<T, V>(object: T, property: string, value: V, message?: string): void
  • Asserts that object has a property named by property with value given by value.

    Type parameters

    • T

    • V

    Parameters

    • object: T

      Container object.

    • property: string

      Potential contained property of object.

    • value: V

      Potential expected property value.

    • Optional message: string

      Message to display on error.

    Returns void

reverseOf

  • reverseOf(val: string, exp: string, msg?: string): void
  • Parameters

    • val: string
    • exp: string
    • Optional msg: string

    Returns void

sameDeepMembers

  • sameDeepMembers<T>(set1: T[], set2: T[], message?: string): void
  • Asserts that set1 and set2 have the same members using deep equality checking. Order is not take into account.

    Type parameters

    • T

    Parameters

    • set1: T[]

      Actual set of values.

    • set2: T[]

      Potential expected set of values.

    • Optional message: string

      Message to display on error.

    Returns void

sameDeepOrderedMembers

  • sameDeepOrderedMembers<T>(set1: T[], set2: T[], message?: string): void
  • Asserts that set1 and set2 have the same members in the same order. Uses a deep equality check.

    Type parameters

    • T

    Parameters

    • set1: T[]

      Actual set of values.

    • set2: T[]

      Potential expected set of values.

    • Optional message: string

      Message to display on error.

    Returns void

sameMembers

  • sameMembers<T>(set1: T[], set2: T[], message?: string): void
  • Asserts that set1 and set2 have the same members. Order is not take into account.

    Type parameters

    • T

    Parameters

    • set1: T[]

      Actual set of values.

    • set2: T[]

      Potential expected set of values.

    • Optional message: string

      Message to display on error.

    Returns void

sameOrderedMembers

  • sameOrderedMembers<T>(set1: T[], set2: T[], message?: string): void
  • Asserts that set1 and set2 have the same members in the same order. Uses a strict equality check (===).

    Type parameters

    • T

    Parameters

    • set1: T[]

      Actual set of values.

    • set2: T[]

      Potential expected set of values.

    • Optional message: string

      Message to display on error.

    Returns void

sealed

  • sealed<T>(object: T, message?: string): void
  • Asserts that object is sealed (can have new properties added to it and its existing properties cannot be removed).

    Type parameters

    • T

    Parameters

    • object: T

      Actual value.

    • Optional message: string

      Message to display on error.

    Returns void

singleLine

  • singleLine(val: string, msg?: string): void
  • Parameters

    • val: string
    • Optional msg: string

    Returns void

startsWith

  • startsWith(val: string, exp: string, msg?: string): void
  • Parameters

    • val: string
    • exp: string
    • Optional msg: string

    Returns void

strictEqual

  • strictEqual<T>(actual: T, expected: T, message?: string): void
  • Asserts strict equality (===) of actual and expected.

    Type parameters

    • T

    Parameters

    • actual: T

      Actual value.

    • expected: T

      Potential expected value.

    • Optional message: string

      Message to display on error.

    Returns void

throw

  • throw(fn: () => void, message?: string): void
  • throw(fn: () => void, regExp: RegExp): void
  • throw(fn: () => void, constructor: ErrorConstructor, message?: string): void
  • throw(fn: () => void, constructor: ErrorConstructor, regExp: RegExp): void
  • Asserts that fn will throw an error.

    Parameters

    • fn: () => void

      Function that may throw.

        • (): void
        • Returns void

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that function will throw an error with message matching regexp.

    Parameters

    • fn: () => void

      Function that may throw.

        • (): void
        • Returns void

    • regExp: RegExp

      Potential expected message match.

    Returns void

  • Asserts that function will throw an error that is an instance of constructor.

    Parameters

    • fn: () => void

      Function that may throw.

        • (): void
        • Returns void

    • constructor: ErrorConstructor

      Potential expected error constructor.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that function will throw an error that is an instance of constructor and an error with message matching regexp.

    Parameters

    • fn: () => void

      Function that may throw.

        • (): void
        • Returns void

    • constructor: ErrorConstructor

      Potential expected error constructor.

    • regExp: RegExp

    Returns void

throws

  • Asserts that fn will throw an error.

    Parameters

    • fn: () => void

      Function that may throw.

        • (): void
        • Returns void

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that function will throw an error with message matching regexp.

    Parameters

    • fn: () => void

      Function that may throw.

        • (): void
        • Returns void

    • errType: RegExp | ErrorConstructor

      Potential expected message match or error constructor.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that function will throw an error that is an instance of constructor and an error with message matching regexp.

    Parameters

    • fn: () => void

      Function that may throw.

        • (): void
        • Returns void

    • constructor: ErrorConstructor

      Potential expected error constructor.

    • regExp: RegExp

    Returns void

typeOf

  • typeOf<T>(value: T, name: string, message?: string): void
  • Asserts that value's type is name, as determined by Object.prototype.toString.

    Type parameters

    • T

    Parameters

    • value: T

      Actual value.

    • name: string

      Potential expected type name of value.

    • Optional message: string

      Message to display on error.

    Returns void