Files
vscode/extensions/copilot/test/e2e/system.stest.ts
kieferrm 333d9a4053 Hello Copilot
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
2025-06-27 11:35:20 +02:00

35 lines
1.4 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 path from 'path';
import { ssuite, stest } from '../base/stest';
import { validate } from '../base/validate';
import { fetchConversationScenarios } from './scenarioLoader';
import { generateScenarioTestRunner } from './scenarioTest';
ssuite({ title: 'system', subtitle: 'identity', location: 'panel' }, (inputPath) => {
const scenarioFolder = inputPath ?? path.join(__dirname, '..', 'test/scenarios/test-system');
const scenarios = fetchConversationScenarios(scenarioFolder);
for (const scenario of scenarios) {
stest({ description: scenario[0].question, language: undefined }, generateScenarioTestRunner(
scenario,
async (accessor, question, answer) => {
const expectedKeywords = scenario.find((s) => s.question === question)?.json.keywords;
if (expectedKeywords !== undefined) {
const err = validate(answer, expectedKeywords);
if (err) {
return { success: false, errorMessage: err };
}
return { success: true, errorMessage: answer };
}
return { success: true, errorMessage: 'No requirements set for test.' };
}
));
}
});