Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • SinonMatch

Callable

  • Requires the value to be == to the given number.

    Parameters

    • value: number

    Returns SinonMatcher

  • Requires the value to be a string and have the expectation as a substring.

    Parameters

    • value: string

    Returns SinonMatcher

  • Requires the value to be a string and match the given regular expression.

    Parameters

    Returns SinonMatcher

  • See custom matchers.

    Parameters

    • callback: (value: any) => boolean
        • (value: any): boolean
        • Parameters

          • value: any

          Returns boolean

    • Optional message: string

    Returns SinonMatcher

  • Requires the value to be not null or undefined and have at least the same properties as expectation. This supports nested matchers.

    Parameters

    • obj: object

    Returns SinonMatcher

Index

Properties

any

Matches anything.

array

Requires the value to be an Array.

bool

Requires the value to be a Boolean

date

Requires the value to be a Date object.

defined

defined: SinonMatcher

Requires the value to be defined.

falsy

Requires the value to be falsy.

func

Requires the value to be a Function.

map

Requires the value to be a Map.

number

number: SinonMatcher

Requires the value to be a Number.

object

object: SinonMatcher

Requires the value to be an Object.

regexp

regexp: SinonMatcher

Requires the value to be a regular expression.

set

Requires the value to be a Set.

string

string: SinonMatcher

Requires the value to be a String.

symbol

symbol: SinonMatcher

Requires the value to be a Symbol.

truthy

truthy: SinonMatcher

Requires the value to be truthy.

Methods

every

  • Requires every element of an Array, Set or Map, or alternatively every value of an Object to match the given matcher.

    Parameters

    Returns SinonMatcher

has

  • Requires the value to define the given property. The property might be inherited via the prototype chain. If the optional expectation is given, the value of the property is deeply compared with the expectation. The expectation can be another matcher.

    Parameters

    • property: string
    • Optional expect: any

    Returns SinonMatcher

hasNested

  • Requires the value to define the given propertyPath. Dot (prop.prop) and bracket (prop[0]) notations are supported as in Lodash.get. The propertyPath might be inherited via the prototype chain. If the optional expectation is given, the value at the propertyPath is deeply compared with the expectation. The expectation can be another matcher.

    Parameters

    • path: string
    • Optional expect: any

    Returns SinonMatcher

hasOwn

  • Same as sinon.match.has but the property must be defined by the value itself. Inherited properties are ignored.

    Parameters

    • property: string
    • Optional expect: any

    Returns SinonMatcher

in

  • Requires the value to be in the specified array.

    Parameters

    • allowed: any[]

    Returns SinonMatcher

instanceOf

  • Requires the value to be an instance of the given type.

    Parameters

    • type: any

    Returns SinonMatcher

same

  • Requires the value to strictly equal ref.

    Parameters

    • obj: any

    Returns SinonMatcher

some

  • Requires any element of an Array, Set or Map, or alternatively any value of an Object to match the given matcher.

    Parameters

    Returns SinonMatcher

typeOf

  • Requires the value to be of the given type, where type can be one of "undefined", "null", "boolean", "number", "string", "object", "function", "array", "regexp", "date" or "symbol".

    Parameters

    • type: string

    Returns SinonMatcher