provideLocationMocks (src/provide_location_mocks.ts)

angular · packages/common/testing/src/provide_location_mocks.ts · typescript · MIT
testing, tag:embed-classified

Angular provider returning mock Location and LocationStrategy for unit tests.

// Source: https://github.com/angular/angular | License: MIT | Copyright 2010-2026 Google LLC. https://angular.dev/license
// Provided via justclaw.it.com; keep this notice with the code.
/**
 * @license
 * Copyright Google LLC 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.dev/license
 */

import {Location, LocationStrategy} from '../../index';
import {Provider} from '@angular/core';

import {SpyLocation} from './location_mock';
import {MockLocationStrategy} from './mock_location_strategy';

/**
 * Returns mock providers for the `Location` and `LocationStrategy` classes.
 * The mocks are helpful in tests to fire simulated location events.
 *
 * @publicApi
 */
export function provideLocation

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key