Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "testUtils"

Index

Functions

Const actAndFlushPromises

  • actAndFlushPromises(): Promise<undefined>
  • Flushes async promises in mocks

    Returns Promise<undefined>

Const makeAuthPusherConfig

  • makeAuthPusherConfig(id?: string, info?: any): { authorizer: any }
  • Generates basic Pusher config with authorizer

    Parameters

    • Default value id: string = "my-id"

      the id for the client

    • Default value info: any = {}

      the info object for the client

    Returns { authorizer: any }

    • authorizer: function
      • authorizer(): { authorize: any }
      • Returns { authorize: any }

        • authorize: function
          • authorize(socketId: string, callback: (errored: boolean, info: any) => void): void
          • Parameters

            • socketId: string
            • callback: (errored: boolean, info: any) => void
                • (errored: boolean, info: any): void
                • Parameters

                  • errored: boolean
                  • info: any

                  Returns void

            Returns void

renderHookWithProvider

  • renderHookWithProvider<T>(hook: () => T, clientConfig?: Record<string, any>): Promise<RenderHookResult<{}, T>>
  • Does a bit of setup for us so we don't have to repeat ourselves

    Type parameters

    • T

    Parameters

    • hook: () => T

      the hook you want to render, i.e. () => useHook()

        • (): T
        • Returns T

    • Default value clientConfig: Record<string, any> = {}

      the client config passed to PusherMock

    Returns Promise<RenderHookResult<{}, T>>

Generated using TypeDoc