Files
vscode/extensions/copilot/test/simulation/slash-test/testGen.csharp.stest.ts
Johannes Rieken fcbff5831a InlineChatIntent (#1549)
* remove references to old setting `github.copilot.chat.advanced.inlineChat2`

* play with `InlineChatIntent`

* wip

* move things, better/simpler prompt

* cleanup, renames, stuff

* more wip

* done after tool call

* edit and generate stest for new InlineChatIntent

* use codebook for diagnostics

* inline chat fixing stests

* stest run

* remove old Inline2 tests

* remove slash commands for v2, remove the editCodeIntent path for v2

* 💄

* 💄

* Don't use `diagnosticsTimeout` when with inline chat because the new diagnostics will never be read but slow down the result

* fix compile error

* stest run

* update baseline

* prevent some JSON errors from empty output

* unfresh baseline.json

* use `MockGithubAvailableEmbeddingTypesService` in stests

* back to hamfisted skipping of stests

* send telemetry from inline chat intent

* tweak some stests
2025-10-29 10:44:00 +00:00

51 lines
2.0 KiB
TypeScript

/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as assert from 'assert';
import { Intent } from '../../../src/extension/common/constants';
import { isQualifiedFile, isRelativeFile } from '../../../src/platform/test/node/simulationWorkspace';
import { Schemas } from '../../../src/util/vs/base/common/network';
import { ssuite, stest } from '../../base/stest';
import { forInline, simulateInlineChatWithStrategy } from '../inlineChatSimulator';
import { getFileContent } from '../outcomeValidators';
import { assertSomeStrings, assertWorkspaceEdit, fromFixture } from '../stestUtil';
forInline((strategy, nonExtensionConfigurations, suffix) => {
ssuite({ title: `/tests${suffix}`, location: 'inline', language: 'csharp', nonExtensionConfigurations }, () => {
stest({ description: 'creates new test file with some assertions and uses correct file name', }, (testingServiceCollection) => {
return simulateInlineChatWithStrategy(strategy, testingServiceCollection, {
files: [
fromFixture('tests/cs-newtest/', 'src/services/Model.cs'),
],
queries: [{
file: 'src/services/Model.cs',
selection: [4, 8, 4, 8],
query: '/tests',
expectedIntent: Intent.Tests,
validate: async (outcome, workspace, accessor) => {
assertWorkspaceEdit(outcome);
assert.strictEqual(outcome.files.length, 1);
const [first] = outcome.files;
assertSomeStrings(getFileContent(first), ['Assert', 'Test', 'MyObject', 'MyMethod']);
if (isQualifiedFile(first)) {
assert.strictEqual(first.uri.scheme, Schemas.untitled);
assert.ok(first.uri.path.endsWith('ModelTest.cs'));
} else if (isRelativeFile(first)) {
assert.ok(first.fileName.endsWith('ModelTest.cs'));
}
}
}]
});
});
});
});