Path: blob/main/extensions/copilot/test/e2e/system.stest.ts
13388 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*--------------------------------------------------------------------------------------------*/4import * as path from 'path';5import { ssuite, stest } from '../base/stest';6import { validate } from '../base/validate';7import { fetchConversationScenarios } from './scenarioLoader';8import { generateScenarioTestRunner } from './scenarioTest';910ssuite({ title: 'system', subtitle: 'identity', location: 'panel' }, (inputPath) => {1112const scenarioFolder = inputPath ?? path.join(__dirname, '..', 'test/scenarios/test-system');13const scenarios = fetchConversationScenarios(scenarioFolder);1415for (const scenario of scenarios) {16stest({ description: scenario[0].question, language: undefined }, generateScenarioTestRunner(17scenario,18async (accessor, question, answer) => {19const expectedKeywords = scenario.find((s) => s.question === question)?.json.keywords;20if (expectedKeywords !== undefined) {21const err = validate(answer, expectedKeywords);22if (err) {23return { success: false, errorMessage: err };24}2526return { success: true, errorMessage: answer };27}2829return { success: true, errorMessage: 'No requirements set for test.' };30}31));32}33});343536