import type { Layer, Viewport } from '@deck.gl/core'; import type { Timeline } from '@luma.gl/engine'; type InitializeLayerTestOptions = { /** The layer instance to test */ layer: Layer; /** The initial viewport * @default WebMercatorViewport */ viewport?: Viewport; /** Callback if any error is thrown */ onError?: (error: unknown, title: string) => void; }; /** Test that initializing a layer does not throw. * Use `testInitializeLayerAsync` if the layer's initialization flow contains async operations. */ export declare function testInitializeLayer(opts: InitializeLayerTestOptions & { /** Automatically finalize the layer and release all resources after the test */ finalize?: true; }): null; export declare function testInitializeLayer(opts: InitializeLayerTestOptions & { /** Automatically finalize the layer and release all resources after the test */ finalize: false; }): { /** Finalize the layer and release all resources */ finalize: () => void; }; /** Test that initializing a layer does not throw. * Resolves when the layer's isLoaded flag becomes true. */ export declare function testInitializeLayerAsync(opts: InitializeLayerTestOptions & { /** Automatically finalize the layer and release all resources after the test */ finalize?: true; }): Promise; export declare function testInitializeLayerAsync(opts: InitializeLayerTestOptions & { /** Automatically finalize the layer and release all resources after the test */ finalize: false; }): Promise<{ /** Finalize the layer and release all resources */ finalize: () => void; }>; /** Spy object compatible with both vitest and probe.gl */ export type Spy = { /** Restore the original method (vitest) */ mockRestore?: () => void; /** Restore the original method (probe.gl) */ restore?: () => void; /** Call history (vitest) */ mock?: { calls: unknown[][]; }; /** Call history (probe.gl) */ calls?: unknown[][]; /** Whether the spy was called (probe.gl) */ called?: boolean; }; /** Factory function to create a spy on an object method */ export type SpyFactory = (obj: object, method: string) => Spy; /** Function to reset/cleanup a spy after each test case */ export type ResetSpy = (spy: Spy) => void; export type LayerClass = { new (...args: any[]): LayerT; layerName: string; defaultProps: any; }; export type LayerTestCase = { title: string; viewport?: Viewport; /** Reset the props of the test layer instance */ props?: Partial; /** Update the given props of the test layer instance */ updateProps?: Partial; /** List of layer method names to watch */ spies?: string[]; /** Called before layer updates */ onBeforeUpdate?: (params: { layer: Layer; testCase: LayerTestCase; }) => void; /** Called after layer is updated */ onAfterUpdate?: (params: { testCase: LayerTestCase; layer: LayerT; oldState: any; subLayers: Layer[]; subLayer: Layer | null; spies: Record; }) => void; }; export type TestLayerOptions = { /** The layer class to test against */ Layer: LayerClass; /** The initial viewport * @default WebMercatorViewport */ viewport?: Viewport; /** * If provided, used to controls time progression. Useful for testing transitions and animations. */ timeline?: Timeline; testCases?: LayerTestCase[]; /** * List of layer method names to watch */ spies?: string[]; /** Callback if any error is thrown */ onError?: (error: Error, title: string) => void; /** Factory function to create spies */ createSpy: SpyFactory; /** Function to reset/cleanup a spy after each test case */ resetSpy: ResetSpy; }; /** * Initialize and updates a layer over a sequence of scenarios (test cases). * Use `testLayerAsync` if the layer's update flow contains async operations. */ export declare function testLayer(opts: TestLayerOptions): void; /** * Initialize and updates a layer over a sequence of scenarios (test cases). * Each test case is awaited until the layer's isLoaded flag is true. */ export declare function testLayerAsync(opts: TestLayerOptions): Promise; export {}; //# sourceMappingURL=lifecycle-test.d.ts.map