Back to Apollo Client

Api Report Testing Internal.Api

.api-reports/api-report-testing_internal.api.md

3.14.110.7 KB
Original Source

API Report File for "@apollo/client"

Do not edit this file. It is a report generated by API Extractor.

ts

import type { ApolloClient } from '@apollo/client';
import { ApolloLink } from '@apollo/client';
import { ApolloLink as ApolloLink_2 } from '@apollo/client/link';
import type { ApolloPayloadResult } from '@apollo/client';
import type { ExecuteContext } from '@apollo/client/link';
import { FetchResult } from '@apollo/client';
import type { GraphQLFormattedError } from 'graphql-17-alpha2';
import type { GraphQLRequest } from '@apollo/client';
import { HttpLink } from '@apollo/client/link/http';
import type { InitialIncrementalExecutionResult } from 'graphql-17-alpha2';
import type { MaskedDocumentNode } from '@apollo/client/masking';
import type { MockedProviderProps } from '@apollo/client/testing/react';
import type { MockLink } from '@apollo/client/testing';
import type { Observable } from 'rxjs';
import { Observable as Observable_2 } from '@apollo/client';
import { Operation } from '@apollo/client';
import type { Queries } from '@testing-library/dom';
import type { queries } from '@testing-library/dom';
import * as React_2 from 'react';
import type * as ReactDOMClient from 'react-dom/client';
import type { RenderHookOptions } from '@testing-library/react';
import type { RenderHookResult } from '@testing-library/react';
import type { RenderOptions } from '@testing-library/react';
import type { RenderResult } from '@testing-library/react';
import type { Subscribable } from 'rxjs';
import type { SubsequentIncrementalExecutionResult } from 'graphql-17-alpha2';
import type { TypedDocumentNode } from '@apollo/client';

// @public (undocumented)
export function actAsync<T>(scope: () => T | Promise<T>): Promise<T>;

// @public (undocumented)
export function addDelayToMocks<T extends MockLink.MockedResponse<unknown>[]>(mocks: T, delay?: number, override?: boolean): {
    request: MockLink.MockedRequest<Record<string, any>>;
    maxUsageCount?: number;
    result?: FetchResult<unknown> | MockLink.ResultFunction<FetchResult<unknown>, Record<string, any>> | undefined;
    error?: Error;
    delay: number | MockLink.DelayFunction;
}[];

// @public (undocumented)
type ConsoleMethod = "log" | "info" | "warn" | "error" | "debug";

// @public (undocumented)
export function createClientWrapper(client: ApolloClient, Wrapper?: React_2.JSXElementConstructor<{
    children: React_2.ReactNode;
}>): React_2.JSXElementConstructor<{
    children: React_2.ReactNode;
}>;

// @public (undocumented)
export function createMockWrapper(renderOptions: MockedProviderProps, Wrapper?: React_2.JSXElementConstructor<{
    children: React_2.ReactNode;
}>): React_2.JSXElementConstructor<{
    children: React_2.ReactNode;
}>;

// @public (undocumented)
export function createOperationWithDefaultContext(context: any, operation: GraphQLRequest, executeContext?: ExecuteContext): Operation;

// @public (undocumented)
export function enableFakeTimers(config?: FakeTimersConfig | LegacyFakeTimersConfig): Disposable;

// @public (undocumented)
export function executeWithDefaultContext(link: ApolloLink_2, operation: GraphQLRequest, context?: ExecuteContext): Observable_2<FetchResult>;

// @public (undocumented)
type HydrateableContainer = Parameters<(typeof ReactDOMClient)["hydrateRoot"]>[0];

// @public (undocumented)
type HydrateableContainer_2 = Parameters<(typeof ReactDOMClient)["hydrateRoot"]>[0];

// @public (undocumented)
interface Letter {
    // (undocumented)
    __typename: "Letter";
    // (undocumented)
    letter: string;
    // (undocumented)
    position: number;
}

// @public (undocumented)
export interface MaskedVariablesCaseData {
    // (undocumented)
    character: {
        __typename: "Character";
        id: string;
    } & {
        " $fragmentRefs"?: {
            MaskedVariablesCaseFragment: MaskedVariablesCaseFragment;
        };
    };
}

// @public (undocumented)
type MaskedVariablesCaseFragment = {
    __typename: "Character";
    name: string;
} & {
    " $fragmentName"?: "MaskedVariablesCaseFragment";
};

// @public (undocumented)
export function mockDeferStream<TData = Record<string, unknown>, TExtensions = Record<string, unknown>>(): {
    httpLink: HttpLink;
    enqueueInitialChunk(chunk: InitialIncrementalExecutionResult<TData, TExtensions>): void;
    enqueueSubsequentChunk(chunk: SubsequentIncrementalExecutionResult<TData, TExtensions>): void;
    enqueueErrorChunk(errors: GraphQLFormattedError[]): void;
};

// @public (undocumented)
export function mockMultipartSubscriptionStream<TData = Record<string, unknown>, TExtensions = Record<string, unknown>>(): {
    httpLink: HttpLink;
    enqueueHeartbeat: () => void;
    enqueuePayloadResult(payload: ApolloPayloadResult<TData, TExtensions>["payload"], hasNext?: boolean): void;
    enqueueProtocolErrors(errors: ApolloPayloadResult["errors"]): void;
};

// @public (undocumented)
type ObservableEvent<T> = {
    type: "next";
    value: T;
} | {
    type: "error";
    error: any;
} | {
    type: "complete";
};

// @public (undocumented)
export class ObservableStream<T> {
    // (undocumented)
    [Symbol.dispose](): void;
    constructor(observable: Observable<T> | Subscribable<T>);
    // (undocumented)
    getCurrent(): T | undefined;
    // Warning: (ae-forgotten-export) The symbol "TakeOptions" needs to be exported by the entry point index.d.ts
    // Warning: (ae-forgotten-export) The symbol "ObservableEvent" needs to be exported by the entry point index.d.ts
    //
    // (undocumented)
    peek({ timeout }?: TakeOptions): Promise<ObservableEvent<T>>;
    // (undocumented)
    take({ timeout }?: TakeOptions): Promise<{
        type: "error";
        error: any;
    } | {
        type: "complete";
    } | {
        type: "next";
        value: T;
    }>;
    // (undocumented)
    takeComplete(options?: TakeOptions): Promise<void>;
    // (undocumented)
    takeError(options?: TakeOptions): Promise<any>;
    // (undocumented)
    takeNext(options?: TakeOptions): Promise<T>;
    // (undocumented)
    unsubscribe(): void;
}

// @public (undocumented)
export interface PaginatedCaseData {
    // Warning: (ae-forgotten-export) The symbol "Letter" needs to be exported by the entry point index.d.ts
    //
    // (undocumented)
    letters: Letter[];
}

// @public (undocumented)
export interface PaginatedCaseVariables {
    // (undocumented)
    limit?: number;
    // (undocumented)
    offset?: number;
}

// Warning: (ae-forgotten-export) The symbol "RendererableContainer" needs to be exported by the entry point index.d.ts
// Warning: (ae-forgotten-export) The symbol "HydrateableContainer" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
export function renderAsync<Q extends Queries = typeof queries, Container extends RendererableContainer | HydrateableContainer = HTMLElement, BaseElement extends RendererableContainer | HydrateableContainer = Container>(ui: React.ReactNode, options: RenderOptions<Q, Container, BaseElement>): Promise<RenderResult<Q, Container, BaseElement>>;

// @public (undocumented)
export function renderAsync(ui: React.ReactNode, options?: Omit<RenderOptions, "queries"> | undefined): Promise<RenderResult>;

// @public (undocumented)
type RendererableContainer = ReactDOMClient.Container;

// @public (undocumented)
type RendererableContainer_2 = ReactDOMClient.Container;

// Warning: (ae-forgotten-export) The symbol "RendererableContainer_2" needs to be exported by the entry point index.d.ts
// Warning: (ae-forgotten-export) The symbol "HydrateableContainer_2" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
export function renderHookAsync<Result, Props, Q extends Queries = typeof queries, Container extends RendererableContainer_2 | HydrateableContainer_2 = HTMLElement, BaseElement extends RendererableContainer_2 | HydrateableContainer_2 = Container>(renderCallback: (initialProps: Props) => Result, options?: RenderHookOptions<Props, Q, Container, BaseElement> | undefined): Promise<RenderHookResult<Result, Props>>;

// @public
export function resetApolloContext(): void;

// @public (undocumented)
export function setupMaskedVariablesCase(): {
    mocks: MockLink.MockedResponse<MaskedVariablesCaseData, Record<string, any>>[];
    query: MaskedDocumentNode<MaskedVariablesCaseData, VariablesCaseVariables>;
    unmaskedQuery: TypedDocumentNode<MaskedVariablesCaseData, VariablesCaseVariables>;
};

// @public (undocumented)
export function setupPaginatedCase(): {
    query: TypedDocumentNode<PaginatedCaseData, PaginatedCaseVariables>;
    link: ApolloLink;
    data: {
        __typename: string;
        letter: string;
        position: number;
    }[];
};

// @public (undocumented)
export function setupSimpleCase(): {
    query: TypedDocumentNode<SimpleCaseData, Record<string, never>>;
    mocks: MockLink.MockedResponse<SimpleCaseData, Record<string, any>>[];
};

// @public (undocumented)
export function setupVariablesCase(): {
    mocks: MockLink.MockedResponse<VariablesCaseData, VariablesCaseVariables>[];
    query: TypedDocumentNode<VariablesCaseData, VariablesCaseVariables>;
};

// @public (undocumented)
export interface SimpleCaseData {
    // (undocumented)
    greeting: string;
}

// Warning: (ae-forgotten-export) The symbol "ConsoleMethod" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
type Spies<Keys extends ConsoleMethod[]> = Record<Keys[number], jest.SpyInstance<void, any[], any>>;

// Warning: (ae-forgotten-export) The symbol "Spies" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
export function spyOnConsole<Keys extends ConsoleMethod[]>(...spyOn: Keys): Spies<Keys> & Disposable;

// @public (undocumented)
export namespace spyOnConsole {
    var // (undocumented)
    takeSnapshots: <Keys extends ConsoleMethod[]>(...spyOn: Keys) => Spies<Keys> & Disposable;
}

// @public (undocumented)
interface TakeOptions {
    // (undocumented)
    timeout?: number;
}

// @public (undocumented)
export interface VariablesCaseData {
    // (undocumented)
    character: {
        __typename: "Character";
        id: string;
        name: string;
    };
}

// @public (undocumented)
export interface VariablesCaseVariables {
    // (undocumented)
    id: string;
}

// @public (undocumented)
export function wait(ms: number): Promise<void>;

// @internal @deprecated (undocumented)
export function withCleanup<T extends object>(item: T, cleanup: (item: T) => void): T & Disposable;

// @public (undocumented)
export function withProdMode(): {
    prevDEV: boolean;
} & Disposable;

// Warnings were encountered during analysis:
//
// src/testing/internal/scenarios/index.ts:81:7 - (ae-forgotten-export) The symbol "MaskedVariablesCaseFragment" needs to be exported by the entry point index.d.ts

// (No @packageDocumentation comment for this package)