1 | /**
|
---|
2 | * @license
|
---|
3 | * Copyright Google LLC All Rights Reserved.
|
---|
4 | *
|
---|
5 | * Use of this source code is governed by an MIT-style license that can be
|
---|
6 | * found in the LICENSE file at https://angular.io/license
|
---|
7 | */
|
---|
8 | import { ResourceLoader } from '@angular/compiler';
|
---|
9 | /**
|
---|
10 | * A mock implementation of {@link ResourceLoader} that allows outgoing requests to be mocked
|
---|
11 | * and responded to within a single test, without going to the network.
|
---|
12 | */
|
---|
13 | export declare class MockResourceLoader extends ResourceLoader {
|
---|
14 | private _expectations;
|
---|
15 | private _definitions;
|
---|
16 | private _requests;
|
---|
17 | get(url: string): Promise<string>;
|
---|
18 | hasPendingRequests(): boolean;
|
---|
19 | /**
|
---|
20 | * Add an expectation for the given URL. Incoming requests will be checked against
|
---|
21 | * the next expectation (in FIFO order). The `verifyNoOutstandingExpectations` method
|
---|
22 | * can be used to check if any expectations have not yet been met.
|
---|
23 | *
|
---|
24 | * The response given will be returned if the expectation matches.
|
---|
25 | */
|
---|
26 | expect(url: string, response: string): void;
|
---|
27 | /**
|
---|
28 | * Add a definition for the given URL to return the given response. Unlike expectations,
|
---|
29 | * definitions have no order and will satisfy any matching request at any time. Also
|
---|
30 | * unlike expectations, unused definitions do not cause `verifyNoOutstandingExpectations`
|
---|
31 | * to return an error.
|
---|
32 | */
|
---|
33 | when(url: string, response: string): void;
|
---|
34 | /**
|
---|
35 | * Process pending requests and verify there are no outstanding expectations. Also fails
|
---|
36 | * if no requests are pending.
|
---|
37 | */
|
---|
38 | flush(): void;
|
---|
39 | /**
|
---|
40 | * Throw an exception if any expectations have not been satisfied.
|
---|
41 | */
|
---|
42 | verifyNoOutstandingExpectations(): void;
|
---|
43 | private _processRequest;
|
---|
44 | }
|
---|