/// /** * Provides util functions to quicker setup of tests. */ import { TestModuleMetadata, ComponentFixture } from '@angular/core/testing'; import { DebugElement, ElementRef, Type } from '@angular/core'; import { GoogleMapsApiService, GoogleMapsComponentApiService } from '@bespunky/angular-google-maps/core'; /** * Creates a `TestModuleMetadata` object that can be passed into `TestBed.configureTestingModule()` in order to * imprort the `GoogleMapsModule` **from the @bespunky/angular-google-maps/core package**, which automatically provides * `NoOpGoogleMapsApiLoader` as the `GoogleMapsApiLoader` token. * * @export * @returns {TestModuleMetadata} A TestBed-ready module configuration. */ export declare function createGoogleMapsTestModuleMetadata(): TestModuleMetadata; /** * Creates a jasmine spy on the `runOutsideAngular()`, `runInsideAngular()`, `runOutsideAngularWhenReady()` or `runInsideAngularWhenReady()` method of the api which fakes its execution. * The fake implementation skips actually running the code outside/outside of angular and proceeds with executing * it directly. * * @export * @param {GoogleMapsApiService} api The api instance to spy on. * @returns {jasmine.Spy} A jasmine spy which can be used to count calls to `api.runOutsideAngular()`. */ export declare function fakeTheRunXsideAngularMethod(api: GoogleMapsApiService, methodName: 'runInsideAngular' | 'runOutsideAngular' | 'runInsideAngularWhenReady' | 'runOutsideAngularWhenReady'): jasmine.Spy; /** * Provides the structure supported for options to pass into the `configureGoogleMapsTestingModule()` function. * * @export * @interface GoogleMapsTestingModuleConfigOptions * @template TComponent */ export interface IGoogleMapsTestingModuleConfigOptions { /** * (Optional) A function that will define the test module imports and providers for the test. * Default is the `createGoogleMapsTestModuleMetadata()` function. */ createTestModuleMetadata?: () => TestModuleMetadata; /** (Optional) A function used to apply additional changes to the module definition before creating the TestBed. */ customize?: (moduleDef: TestModuleMetadata) => void; /** * (Optional) The type of component being tested. If specified, will declare the component, compile it, and extract * the fixture, component, debugElement, and the native element objects. */ componentType?: Type; /** (Optional) A function to execute before the component is created. Example use case could be spying on a component's constructor. */ beforeComponentInit?: (api: GoogleMapsApiService, componentApi: GoogleMapsComponentApiService) => void; /** (Optional) Configures the automation of jasmine spies. */ spies?: { /** `true` to fake the execution of `api.runInsideAngular()` (@see `fakeTheRunXsideAngularMethod()`); `false` to spy and call through. Default is `true`. */ fakeRunInsideAngular?: boolean; /** `true` to fake the execution of `api.runOutsideAngular()` (@see `fakeTheRunXsideAngularMethod()`); `false` to spy and call through. Default is `true`. */ fakeRunOutsideAngular?: boolean; /** `true` to fake the execution of `api.runInsideAngularWhenReady()` (@see `fakeTheRunXsideAngularMethod()`); `false` to spy and call through. Default is `true`. */ fakeRunInsideAngularWhenReady?: boolean; /** `true` to fake the execution of `api.runOutsideAngularWhenReady()` (@see `fakeTheRunXsideAngularMethod()`); `false` to spy and call through. Default is `true`. */ fakeRunOutsideAngularWhenReady?: boolean; }; } /** * Configures a basic testing module with common definitions for Google Maps components and extracts useful tools and services. * This should allow faster setup without the redundancy of declarations and extractions of services. * After calling this function, the caller can simply deconstruct the tools and use them. * * @example let { api, component } = createGoogleMapsTestingModule({ componentType: GoogleMapsComponent }); * @export * @template TComponent The type of the component being tested (if there is a component). * @param {IGoogleMapsTestingModuleConfigOptions} [options] (Optional) The options for the configuring the test module. * @returns The created tools and services, ready to use. */ export declare function configureGoogleMapsTestingModule(options?: IGoogleMapsTestingModuleConfigOptions): Promise<{ fixture: ComponentFixture; component: TComponent; debugElement: DebugElement; element: ElementRef; api: GoogleMapsApiService; componentApi: GoogleMapsComponentApiService; spies: { runInsideAngular: jasmine.Spy; runOutsideAngular: jasmine.Spy; runInsideAngularWhenReady: jasmine.Spy; runOutsideAngularWhenReady: jasmine.Spy; }; }>;