@types/cavy
TypeScript icon, indicating that this package has built-in type declarations

3.2.9 • Public • Published

Installation

npm install --save @types/cavy

Summary

This package contains type definitions for cavy (https://github.com/pixielabs/cavy).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/cavy.

index.d.ts

import * as React from "react";

// Turn off automatic exporting by exporting {}.
export {};

type TestHookGeneratorWithRefCallback = (label: string, ref?: React.RefCallback<any>) => React.RefCallback<any>;

type TestHookGeneratorWithRefObject = (label: string, ref?: React.RefObject<any>) => React.RefObject<any>;

export type TestHookGenerator = TestHookGeneratorWithRefCallback & TestHookGeneratorWithRefObject;

export type WithTestHook<P extends {}> = P & { generateTestHook: TestHookGenerator };

export function hook<P extends {}>(WrappedComponent: React.ComponentClass<WithTestHook<P>>): React.ComponentClass<P>;

export function useCavy(): TestHookGenerator;

export function wrap<P extends {}>(
    WrappedComponent: React.ComponentClass<P> | React.FunctionComponent<P>,
): React.ComponentClass<P>;

export interface TesterProps {
    children: React.ReactElement;
    store: TestHookStore;
    specs: Array<(spec: TestScope) => void>;
    waitTime?: number | undefined;
    startDelay?: number | undefined;
    clearAsyncStorage?: boolean | undefined;
    reporter?: ((report: TestReport) => void) | undefined;

    // Deprecated
    sendReport?: boolean | undefined;
}

export class Tester extends React.Component<TesterProps> {
    reRender(): void;
    clearAsync(): Promise<void>;
}

export class TestHookStore {}

export class TestScope {
    component: Tester;
    findComponent(identifier: string): Promise<React.Component>;
    describe(label: string, fn: () => void): void;
    it(label: string, fn: () => void): void;
    beforeEach(fn: () => void): void;
    press(identifier: string): Promise<void>;
    fillIn(identifier: string, str: string): Promise<void>;
    focus(identifier: string): Promise<void>;
    pause(time: number): Promise<void>;
    exists(identifier: string): Promise<true>;
    notExists(identifier: string): Promise<true>;
    containsText(identifier: string, text: string): Promise<void>;
}

export interface TestResult {
    message: string;
    passed: boolean;
}

export interface TestReport {
    results: readonly TestResult[];
    errorCount: number;
    duration: number;
}

Additional Details

  • Last updated: Thu, 21 Dec 2023 19:06:51 GMT
  • Dependencies: @types/react

Credits

These definitions were written by Tyler Hoffman, and Abigail McPhillips.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/cavy

Weekly Downloads

178

Version

3.2.9

License

MIT

Unpacked Size

7.05 kB

Total Files

5

Last publish

Collaborators

  • types