Options
All
  • Public
  • Public/Protected
  • All
Menu

redux-thunk-testing

Index

Type aliases

CallList

CallList: TestAction[]

CallList is a lit of TestActions which are executed during the process of executing a thunk.

JestCallList

JestCallList: CallList[]

jest.fn().mock.calls

TestAction

TestAction: AsyncAction | AnyAction

A Test Action defines actions which conforms to either an AsyncAction or an AnyAction.

ThunkArgs

ThunkArgs: [undefined | null | Function, unknown]

ThunkArgs refers to the "getState" and "extraArguments" parameters of a thunk. For reference, a thunk is called with the following signature (dispatch, getState, extraArguments.)

In the context of this project, these are used with mocks to guide the executed thunk to a particular execution flow for testing.

Variables

Const THUNK_ACTION

THUNK_ACTION: "THUNK_ACTION" = "THUNK_ACTION"

Action type for those functions that returns a thunk

Const actionNormaliser

actionNormaliser: actionNormalizer = actionNormalizer

Alias for actionNormalizer

Functions

actionArraySnapshot

  • Creates a snapshot representation for all values within an array

    Parameters

    Returns string

    A pretty-formatted stringified list of actions.

actionNormalizer

  • Normalizes actions by converting thunks into an AsyncAction

    Parameters

    • action: TestAction | Function

      An action or thunk

    Returns TestAction

    An action object

actionSnapshot

  • actionSnapshot(action: TestAction | Function): string
  • Creates a snapshot friendly representation of an action.

    Parameters

    • action: TestAction | Function

      An action or thunk.

    Returns string

    A pretty-formatted stringified action or thunk.

actionTesterSnapshot

  • Creates a snapshot representation of entire action call stack of an ActionStore

    Parameters

    • tester: ActionStore

      An ActionStore compatible instance.

    Returns string

    A pretty-formatted stringified list of actions.

actionTracer

  • Gets a tracer instance for the specified ActionStore

    Parameters

    • tester: ActionStore

      An ActionStore compatible instance.

    Returns ActionTracer

    An action tracer

actionTypes

  • Gets an array of action.types from the call stack of the specified ActionStore

    Parameters

    • tester: ActionStore

      An ActionStore compaitble instance

    Returns string[]

    An array of action.types

createActionRunner

  • An action runner runs an action and recursively executes all thunks that are found within the executed action as well and it's subsequent actions.

    Parameters

    • tester: ActionStore

      An ActionStore compatible instance.

    • Rest ...thunkArgs: ThunkArgs

      getState and extraArguments of a thunk

    Returns ActionRunner

    An action runner.

createSnapshotString

  • createSnapshotString(value: any): string
  • Normalizes and stringifies the values using pretty-format

    Parameters

    • value: any

      Any value

    Returns string

    A pretty-formatted stringified value.

Generated using TypeDoc