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

    3.2.1 • 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

    // Type definitions for cavy 3.2
    // Project: https://github.com/pixielabs/cavy
    // Definitions by: Tyler Hoffman <https://github.com/tyler-hoffman>
    //                 Abigail McPhillips <https://github.com/AbigailMcP>
    // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
    // TypeScript Version: 3.0
    
    import * as React from 'react';
    
    // Turn off automatic exporting by exporting {}.
    export {};
    
    type RefCallback = (element: React.ReactNode | null) => void;
    
    type TestHookGeneratorWithRefCallback = (label: string, ref?: RefCallback) => RefCallback;
    
    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.FunctionComponent<P>): React.ComponentClass<P>;
    
    export interface TesterProps {
        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: ReadonlyArray<TestResult>;
        errorCount: number;
        duration: number;
    }

    Additional Details

    • Last updated: Thu, 08 Jul 2021 09:07:10 GMT
    • Dependencies: @types/react
    • Global values: none

    Credits

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

    Keywords

    none

    Install

    npm i @types/cavy

    DownloadsWeekly Downloads

    746

    Version

    3.2.1

    License

    MIT

    Unpacked Size

    7.67 kB

    Total Files

    4

    Last publish

    Collaborators

    • types