/** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ import { Provider, ReflectiveInjector, Type } from '../index'; /** * @experimental */ export declare class TestInjector { private _instantiated; private _injector; private _providers; reset(): void; platformProviders: Array; applicationProviders: Array; addProviders(providers: Array): void; createInjector(): ReflectiveInjector; get(token: any): any; execute(tokens: any[], fn: Function): any; } /** * @experimental */ export declare function getTestInjector(): TestInjector; /** * Set the providers that the test injector should use. These should be providers * common to every test in the suite. * * This may only be called once, to set up the common providers for the current test * suite on the current platform. If you absolutely need to change the providers, * first use `resetBaseTestProviders`. * * Test Providers for individual platforms are available from * 'angular2/platform/testing/'. * * @experimental */ export declare function setBaseTestProviders(platformProviders: Array, applicationProviders: Array): void; /** * Reset the providers for the test injector. * * @experimental */ export declare function resetBaseTestProviders(): void; /** * Allows injecting dependencies in `beforeEach()` and `it()`. * * Example: * * ``` * beforeEach(inject([Dependency, AClass], (dep, object) => { * // some code that uses `dep` and `object` * // ... * })); * * it('...', inject([AClass], (object) => { * object.doSomething(); * expect(...); * }) * ``` * * Notes: * - inject is currently a function because of some Traceur limitation the syntax should * eventually * becomes `it('...', @Inject (object: AClass, async: AsyncTestCompleter) => { ... });` * * @stable */ export declare function inject(tokens: any[], fn: Function): () => any; /** * @experimental */ export declare class InjectSetupWrapper { private _providers; constructor(_providers: () => any); private _addProviders(); inject(tokens: any[], fn: Function): () => any; } /** * @experimental */ export declare function withProviders(providers: () => any): InjectSetupWrapper;