1 | import { FetchResult, Observable as LinkObservable } from '@apollo/client/core';
|
2 | import { ApolloTestingController, MatchOperation } from './controller';
|
3 | import { TestOperation, Operation } from './operation';
|
4 | import * as i0 from "@angular/core";
|
5 | /**
|
6 | * A testing backend for `Apollo`.
|
7 | *
|
8 | * `ApolloTestingBackend` works by keeping a list of all open operations.
|
9 | * As operations come in, they're added to the list. Users can assert that specific
|
10 | * operations were made and then flush them. In the end, a verify() method asserts
|
11 | * that no unexpected operations were made.
|
12 | */
|
13 | export declare class ApolloTestingBackend implements ApolloTestingController {
|
14 | /**
|
15 | * List of pending operations which have not yet been expected.
|
16 | */
|
17 | private open;
|
18 | /**
|
19 | * Handle an incoming operation by queueing it in the list of open operations.
|
20 | */
|
21 | handle(op: Operation): LinkObservable<FetchResult>;
|
22 | /**
|
23 | * Helper function to search for operations in the list of open operations.
|
24 | */
|
25 | private _match;
|
26 | private matchOp;
|
27 | private compare;
|
28 | /**
|
29 | * Search for operations in the list of open operations, and return all that match
|
30 | * without asserting anything about the number of matches.
|
31 | */
|
32 | match(match: MatchOperation): TestOperation[];
|
33 | /**
|
34 | * Expect that a single outstanding request matches the given matcher, and return
|
35 | * it.
|
36 | *
|
37 | * operations returned through this API will no longer be in the list of open operations,
|
38 | * and thus will not match twice.
|
39 | */
|
40 | expectOne(match: MatchOperation, description?: string): TestOperation;
|
41 | /**
|
42 | * Expect that no outstanding operations match the given matcher, and throw an error
|
43 | * if any do.
|
44 | */
|
45 | expectNone(match: MatchOperation, description?: string): void;
|
46 | /**
|
47 | * Validate that there are no outstanding operations.
|
48 | */
|
49 | verify(): void;
|
50 | private isDocumentNode;
|
51 | private descriptionFromMatcher;
|
52 | static ɵfac: i0.ɵɵFactoryDeclaration<ApolloTestingBackend, never>;
|
53 | static ɵprov: i0.ɵɵInjectableDeclaration<ApolloTestingBackend>;
|
54 | }
|