Path: blob/main/src/vs/platform/agentHost/test/common/agentService.test.ts
13399 views
/*---------------------------------------------------------------------------------------------1* Copyright (c) Microsoft Corporation. All rights reserved.2* Licensed under the MIT License. See License.txt in the project root for license information.3*--------------------------------------------------------------------------------------------*/45import assert from 'assert';6import { URI } from '../../../../base/common/uri.js';7import { ensureNoDisposablesAreLeakedInTestSuite } from '../../../../base/test/common/utils.js';8import { AgentSession } from '../../common/agentService.js';910suite('AgentSession namespace', () => {1112ensureNoDisposablesAreLeakedInTestSuite();1314test('uri creates a URI with provider as scheme and id as path', () => {15const session = AgentSession.uri('copilot', 'abc-123');16assert.strictEqual(session.scheme, 'copilot');17assert.strictEqual(session.path, '/abc-123');18});1920test('id extracts the raw session ID from a session URI', () => {21const session = URI.from({ scheme: 'copilot', path: '/my-session-42' });22assert.strictEqual(AgentSession.id(session), 'my-session-42');23});2425test('uri and id are inverse operations', () => {26const rawId = 'test-session-xyz';27const session = AgentSession.uri('copilot', rawId);28assert.strictEqual(AgentSession.id(session), rawId);29});3031test('provider extracts copilot from a copilot-scheme URI', () => {32const session = AgentSession.uri('copilot', 'sess-1');33assert.strictEqual(AgentSession.provider(session), 'copilot');34});35});363738