angular/devtools/projects/shell-browser/src/app/comm-utils.spec.ts
Matthieu Riegler 302ea2ee46 fix(devtools): scope the message bus with URLs to prevent cross message interference
This prevents us from having detectAngular from running indefinitely.
2026-02-11 14:38:33 -08:00

33 lines
1.2 KiB
TypeScript

/**
* @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 {stripUrlQueryParamsAndFragment} from './comm-utils';
describe('Communication utils', () => {
describe('stripUrlQueryParamsAndFragment', () => {
it('should return the URL', () => {
const url = stripUrlQueryParamsAndFragment('https://example.com');
expect(url).toEqual('https://example.com');
});
it('should strip the URL from its query parameters', () => {
const url = stripUrlQueryParamsAndFragment('https://example.com?foo=bar&baz=314');
expect(url).toEqual('https://example.com');
});
it('should strip the URL from its fragment', () => {
const url = stripUrlQueryParamsAndFragment('https://example.com#main-heading');
expect(url).toEqual('https://example.com');
});
it('should strip the URL from both its query params and fragment', () => {
const url = stripUrlQueryParamsAndFragment('https://example.com?foo=bar#main-heading');
expect(url).toEqual('https://example.com');
});
});
});