Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/src/vs/sessions/test/common/agentHostSessionsProvider.test.ts
13394 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 { ensureNoDisposablesAreLeakedInTestSuite } from '../../../base/test/common/utils.js';
8
import { buildMutableConfigSchema } from '../../common/agentHostSessionsProvider.js';
9
10
suite('buildMutableConfigSchema', () => {
11
12
ensureNoDisposablesAreLeakedInTestSuite();
13
14
test('derives per-value schema entries and special-cases autoApprove', () => {
15
const actual = buildMutableConfigSchema({
16
autoApprove: 'default',
17
mode: 'worktree',
18
timeout: 5000,
19
enabled: true,
20
tags: ['a', 'b'],
21
permissions: { allow: ['Tool'], deny: [] },
22
nothing: undefined,
23
missing: null,
24
});
25
26
assert.deepStrictEqual(actual, {
27
autoApprove: {
28
type: 'string',
29
title: 'autoApprove',
30
sessionMutable: true,
31
enum: ['default', 'autoApprove', 'autopilot'],
32
},
33
mode: {
34
type: 'string',
35
title: 'mode',
36
sessionMutable: true,
37
enum: ['worktree'],
38
},
39
timeout: { type: 'number', title: 'timeout', sessionMutable: true },
40
enabled: { type: 'boolean', title: 'enabled', sessionMutable: true },
41
tags: { type: 'array', title: 'tags', sessionMutable: true },
42
permissions: { type: 'object', title: 'permissions', sessionMutable: true },
43
// `undefined` and `null` are omitted — they aren't representable in
44
// the config schema.
45
});
46
});
47
});
48
49