Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/src/vs/platform/agentHost/test/common/agentService.test.ts
13399 views
1
/*---------------------------------------------------------------------------------------------
2
* Copyright (c) Microsoft Corporation. All rights reserved.
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
*--------------------------------------------------------------------------------------------*/
5
6
import assert from 'assert';
7
import { URI } from '../../../../base/common/uri.js';
8
import { ensureNoDisposablesAreLeakedInTestSuite } from '../../../../base/test/common/utils.js';
9
import { AgentSession } from '../../common/agentService.js';
10
11
suite('AgentSession namespace', () => {
12
13
ensureNoDisposablesAreLeakedInTestSuite();
14
15
test('uri creates a URI with provider as scheme and id as path', () => {
16
const session = AgentSession.uri('copilot', 'abc-123');
17
assert.strictEqual(session.scheme, 'copilot');
18
assert.strictEqual(session.path, '/abc-123');
19
});
20
21
test('id extracts the raw session ID from a session URI', () => {
22
const session = URI.from({ scheme: 'copilot', path: '/my-session-42' });
23
assert.strictEqual(AgentSession.id(session), 'my-session-42');
24
});
25
26
test('uri and id are inverse operations', () => {
27
const rawId = 'test-session-xyz';
28
const session = AgentSession.uri('copilot', rawId);
29
assert.strictEqual(AgentSession.id(session), rawId);
30
});
31
32
test('provider extracts copilot from a copilot-scheme URI', () => {
33
const session = AgentSession.uri('copilot', 'sess-1');
34
assert.strictEqual(AgentSession.provider(session), 'copilot');
35
});
36
});
37
38