• Creates function that initializes engine for integration testing of react components

    Type Parameters

    • Props

    • Queries extends Record<string, AccessorParamsType>

    • Wrappers extends Record<string, WrapperType<any, any>>

    • FireEvents extends Record<string, [keyof Queries, EventType]>

    • Scenarios extends Record<string, [keyof Queries, ((element, ...args) => Promise<void>)]>

    Parameters

    • Component: ComponentType<Props>

      target component

    • defaultProps: Props

      stubs for required props

    • parameters: Readonly<{
          fireEvents?: FireEvents;
          queries: Queries;
          scenarios?: Scenarios;
          wrapperDefaultParams?: {
              [Key in string | number | symbol]: Parameters<Wrappers[Key]>[1]
          };
          wrappers?: Wrappers;
      }>

      named accessors, wrappers, events etc.

    Returns ((props, parameters?) => Readonly<{
        accessors: {
            [Key in string | number | symbol]: Readonly<{
                find: (() => Promise<HTMLElement>);
                findAll: (() => Promise<HTMLElement[]>);
                get: (() => HTMLElement);
                getAll: (() => HTMLElement[]);
                query: (() => null | HTMLElement);
                queryAll: (() => HTMLElement[]);
            }>
        };
        fireEvent: ((eventKey, options?) => void);
        qs: RenderResult;
        run: (<Key>(scenarioKey, ...args) => Promise<void>);
        wrappers: {
            [Key in string | number | symbol]: ReturnType<Wrappers[Key]>[1]
        };
    }>)

      • (props, parameters?): Readonly<{
            accessors: {
                [Key in string | number | symbol]: Readonly<{
                    find: (() => Promise<HTMLElement>);
                    findAll: (() => Promise<HTMLElement[]>);
                    get: (() => HTMLElement);
                    getAll: (() => HTMLElement[]);
                    query: (() => null | HTMLElement);
                    queryAll: (() => HTMLElement[]);
                }>
            };
            fireEvent: ((eventKey, options?) => void);
            qs: RenderResult;
            run: (<Key>(scenarioKey, ...args) => Promise<void>);
            wrappers: {
                [Key in string | number | symbol]: ReturnType<Wrappers[Key]>[1]
            };
        }>
      • function that renders components and initializes accessors, events, wrappers etc.

        Parameters

        • props: Partial<Props>

          props of target component

        • parameters: {
              wrapperParams?: Partial<{
                  [Key in string | number | symbol]: Parameters<Wrappers[Key]>[1]
              }>;
          } = {}

          parameters of wrappers

          • Optional wrapperParams?: Partial<{
                [Key in string | number | symbol]: Parameters<Wrappers[Key]>[1]
            }>

        Returns Readonly<{
            accessors: {
                [Key in string | number | symbol]: Readonly<{
                    find: (() => Promise<HTMLElement>);
                    findAll: (() => Promise<HTMLElement[]>);
                    get: (() => HTMLElement);
                    getAll: (() => HTMLElement[]);
                    query: (() => null | HTMLElement);
                    queryAll: (() => HTMLElement[]);
                }>
            };
            fireEvent: ((eventKey, options?) => void);
            qs: RenderResult;
            run: (<Key>(scenarioKey, ...args) => Promise<void>);
            wrappers: {
                [Key in string | number | symbol]: ReturnType<Wrappers[Key]>[1]
            };
        }>

        engine for integration testing

Generated using TypeDoc