@skyramp/mcp 0.3.2-rc.pom-3 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/commands/commandLibrary.d.ts +1 -0
- package/build/commands/commandLibrary.js +19 -13
- package/build/commands/localDevTestChangesCommand.d.ts +15 -0
- package/build/commands/localDevTestChangesCommand.js +201 -0
- package/build/index.js +80 -6
- package/build/prompts/code-reuse.js +3 -0
- package/build/prompts/enhance-assertions/sharedAssertionRules.d.ts +1 -0
- package/build/prompts/enhance-assertions/sharedAssertionRules.js +17 -0
- package/build/prompts/initialize-workspace/initializeWorkspacePrompt.js +11 -9
- package/build/prompts/local-dev/local-dev-plan.d.ts +35 -0
- package/build/prompts/local-dev/local-dev-plan.js +429 -0
- package/build/prompts/local-dev/local-dev-prompts.d.ts +4 -0
- package/build/prompts/local-dev/local-dev-prompts.js +190 -0
- package/build/prompts/pom-aware-code-reuse.js +12 -0
- package/build/prompts/prompt-utils.d.ts +8 -0
- package/build/prompts/prompt-utils.js +33 -0
- package/build/prompts/sut-setup/modes/adaptWorkflowPrompt.js +37 -14
- package/build/prompts/sut-setup/shared.js +16 -12
- package/build/prompts/test-recommendation/analysisOutputPrompt.js +21 -29
- package/build/prompts/test-recommendation/scopeAssessment.d.ts +24 -7
- package/build/prompts/test-recommendation/scopeAssessment.js +111 -12
- package/build/prompts/test-recommendation/test-recommendation-prompt.js +41 -4
- package/build/prompts/testbot/testbot-prompts.d.ts +0 -5
- package/build/prompts/testbot/testbot-prompts.js +32 -52
- package/build/recommendation/planRanker.d.ts +15 -2
- package/build/recommendation/planRanker.js +76 -5
- package/build/resources/testbotResource.js +2 -1
- package/build/services/AnalyticsService.d.ts +1 -1
- package/build/services/TestExecutionService.d.ts +2 -1
- package/build/services/TestExecutionService.js +8 -3
- package/build/services/TestGenerationService.d.ts +2 -2
- package/build/services/TestGenerationService.js +39 -21
- package/build/services/containerEnv.js +3 -1
- package/build/tool-phases.js +6 -0
- package/build/tools/code-refactor/codeReuseTool.js +43 -4
- package/build/tools/code-refactor/enhanceAssertionsTool.js +68 -18
- package/build/tools/code-refactor/reuse-outcome.d.ts +109 -0
- package/build/tools/code-refactor/reuse-outcome.js +158 -0
- package/build/tools/code-refactor/reuse-state.d.ts +45 -0
- package/build/tools/code-refactor/reuse-state.js +140 -0
- package/build/tools/enrichTestWithMocksTool.d.ts +28 -0
- package/build/tools/enrichTestWithMocksTool.js +726 -0
- package/build/tools/executeSkyrampTestTool.d.ts +11 -0
- package/build/tools/executeSkyrampTestTool.js +62 -21
- package/build/tools/generate-tests/batchMockGenerationTool.d.ts +106 -0
- package/build/tools/generate-tests/batchMockGenerationTool.js +545 -0
- package/build/tools/generate-tests/generateBatchScenarioRestTool.js +25 -23
- package/build/tools/generate-tests/generateContractRestTool.js +2 -2
- package/build/tools/generate-tests/generateE2ERestTool.d.ts +1 -1
- package/build/tools/generate-tests/generateE2ERestTool.js +1 -1
- package/build/tools/generate-tests/generateLoadRestTool.d.ts +1 -1
- package/build/tools/generate-tests/generateLoadRestTool.js +1 -1
- package/build/tools/generate-tests/generateMockRestTool.d.ts +179 -6
- package/build/tools/generate-tests/generateMockRestTool.js +391 -22
- package/build/tools/generate-tests/loadTestSchema.d.ts +1 -1
- package/build/tools/generate-tests/planGuard.js +2 -22
- package/build/tools/generateEnrichedIntegrationTestTool.d.ts +25 -0
- package/build/tools/generateEnrichedIntegrationTestTool.js +235 -0
- package/build/tools/localDevWorkerComposeTool.d.ts +24 -0
- package/build/tools/localDevWorkerComposeTool.js +264 -0
- package/build/tools/one-click/oneClickTool.d.ts +13 -0
- package/build/tools/one-click/oneClickTool.js +195 -24
- package/build/tools/preflightMockCheckTool.d.ts +2 -0
- package/build/tools/preflightMockCheckTool.js +96 -0
- package/build/tools/queryProxyMocksTool.d.ts +70 -0
- package/build/tools/queryProxyMocksTool.js +522 -0
- package/build/tools/runExistingTestsTool.d.ts +31 -0
- package/build/tools/runExistingTestsTool.js +214 -13
- package/build/tools/submitReportTool.js +38 -3
- package/build/tools/test-management/analyzeChangesTool.d.ts +2 -1
- package/build/tools/test-management/analyzeChangesTool.js +63 -40
- package/build/tools/test-management/registerTestPlanTool.js +55 -7
- package/build/tools/trace/startTraceCollectionTool.js +3 -3
- package/build/types/FrontendIntegration.d.ts +3 -0
- package/build/types/FrontendIntegration.js +3 -0
- package/build/types/OneClickCommands.d.ts +1 -1
- package/build/types/Recommendation.d.ts +20 -0
- package/build/types/Recommendation.js +32 -6
- package/build/types/RepositoryAnalysis.d.ts +131 -14
- package/build/types/RepositoryAnalysis.js +16 -2
- package/build/types/ReuseOutcome.d.ts +63 -0
- package/build/types/ReuseOutcome.js +33 -0
- package/build/types/TestExecution.d.ts +1 -0
- package/build/types/TestTypes.d.ts +25 -7
- package/build/types/TestTypes.js +22 -6
- package/build/types/TestbotReport.d.ts +7 -0
- package/build/types/index.d.ts +2 -0
- package/build/types/index.js +1 -0
- package/build/utils/AnalysisStateManager.d.ts +26 -0
- package/build/utils/AnalysisStateManager.js +31 -1
- package/build/utils/analyze-openapi.js +18 -1
- package/build/utils/branchDiff.d.ts +17 -1
- package/build/utils/branchDiff.js +99 -14
- package/build/utils/featureFlags.d.ts +31 -0
- package/build/utils/featureFlags.js +37 -0
- package/build/utils/frontendIntegration.js +8 -1
- package/build/utils/grpcMockValidation.d.ts +1 -0
- package/build/utils/grpcMockValidation.js +49 -0
- package/build/utils/httpMethodValidation.d.ts +4 -0
- package/build/utils/httpMethodValidation.js +15 -0
- package/build/utils/logger.js +1 -1
- package/build/utils/mockCompatibility.d.ts +49 -0
- package/build/utils/mockCompatibility.js +82 -0
- package/build/utils/pom-scope/pom-files.js +7 -0
- package/build/utils/pom-verify/bindings.js +11 -1
- package/build/utils/pom-verify/re-exports.d.ts +10 -0
- package/build/utils/pom-verify/re-exports.js +61 -0
- package/build/utils/pom-verify/resolve.d.ts +4 -1
- package/build/utils/pom-verify/resolve.js +7 -4
- package/build/utils/pom-verify/verify.d.ts +5 -0
- package/build/utils/pom-verify/verify.js +25 -3
- package/build/utils/progress.js +10 -5
- package/build/utils/proxy-terminal.js +3 -3
- package/build/utils/routeParsers.d.ts +3 -9
- package/build/utils/routeParsers.js +79 -4
- package/build/utils/utils.js +2 -2
- package/build/utils/versions.d.ts +4 -3
- package/build/utils/versions.js +3 -1
- package/build/utils/workspaceAuth.d.ts +46 -0
- package/build/utils/workspaceAuth.js +156 -1
- package/build/workspace/testSuites.d.ts +2 -1
- package/build/workspace/testSuites.js +1 -1
- package/build/workspace/workspace.d.ts +108 -32
- package/build/workspace/workspace.js +32 -4
- package/package.json +5 -2
- package/build/adapters/jestAdapter.test.d.ts +0 -1
- package/build/adapters/jestAdapter.test.js +0 -93
- package/build/adapters/mochaAdapter.test.d.ts +0 -1
- package/build/adapters/mochaAdapter.test.js +0 -63
- package/build/adapters/playwrightAdapter.test.d.ts +0 -1
- package/build/adapters/playwrightAdapter.test.js +0 -169
- package/build/adapters/pytestAdapter.test.d.ts +0 -1
- package/build/adapters/pytestAdapter.test.js +0 -90
- package/build/prompts/code-reuse.test.d.ts +0 -1
- package/build/prompts/code-reuse.test.js +0 -62
- package/build/prompts/pom-aware-code-reuse.test.d.ts +0 -1
- package/build/prompts/pom-aware-code-reuse.test.js +0 -11
- package/build/prompts/test-maintenance/drift-analysis-prompt.test.d.ts +0 -1
- package/build/prompts/test-maintenance/drift-analysis-prompt.test.js +0 -51
- package/build/prompts/test-recommendation/analysisOutputPrompt.test.d.ts +0 -1
- package/build/prompts/test-recommendation/analysisOutputPrompt.test.js +0 -264
- package/build/prompts/test-recommendation/mergeEnrichedScenarios.test.d.ts +0 -1
- package/build/prompts/test-recommendation/mergeEnrichedScenarios.test.js +0 -126
- package/build/prompts/test-recommendation/promptPlan.test.d.ts +0 -1
- package/build/prompts/test-recommendation/promptPlan.test.js +0 -336
- package/build/prompts/test-recommendation/scopeAssessment.test.d.ts +0 -1
- package/build/prompts/test-recommendation/scopeAssessment.test.js +0 -371
- package/build/prompts/test-recommendation/test-recommendation-prompt.test.d.ts +0 -1
- package/build/prompts/test-recommendation/test-recommendation-prompt.test.js +0 -1925
- package/build/prompts/testbot/testbot-prompts.test.d.ts +0 -1
- package/build/prompts/testbot/testbot-prompts.test.js +0 -451
- package/build/recommendation/budgeters/diversityBalancedBudgeter.test.d.ts +0 -1
- package/build/recommendation/budgeters/diversityBalancedBudgeter.test.js +0 -138
- package/build/recommendation/budgeters/fixedNBudgeter.test.d.ts +0 -1
- package/build/recommendation/budgeters/fixedNBudgeter.test.js +0 -66
- package/build/recommendation/discriminators.test.d.ts +0 -1
- package/build/recommendation/discriminators.test.js +0 -324
- package/build/recommendation/diversity.test.d.ts +0 -1
- package/build/recommendation/diversity.test.js +0 -77
- package/build/recommendation/planRanker.test.d.ts +0 -1
- package/build/recommendation/planRanker.test.js +0 -110
- package/build/resources/testbotResource.test.d.ts +0 -1
- package/build/resources/testbotResource.test.js +0 -44
- package/build/services/AnalyticsService.test.d.ts +0 -1
- package/build/services/AnalyticsService.test.js +0 -86
- package/build/services/ScenarioGenerationService.integration.test.d.ts +0 -1
- package/build/services/ScenarioGenerationService.integration.test.js +0 -162
- package/build/services/ScenarioGenerationService.test.d.ts +0 -1
- package/build/services/ScenarioGenerationService.test.js +0 -414
- package/build/services/TestDiscoveryService.test.d.ts +0 -1
- package/build/services/TestDiscoveryService.test.js +0 -983
- package/build/services/TestExecutionService.test.d.ts +0 -1
- package/build/services/TestExecutionService.test.js +0 -1032
- package/build/services/TestGenerationService.test.d.ts +0 -1
- package/build/services/TestGenerationService.test.js +0 -578
- package/build/tool-phase-coverage.test.d.ts +0 -1
- package/build/tool-phase-coverage.test.js +0 -49
- package/build/tools/code-refactor/codeReuseTool.test.d.ts +0 -1
- package/build/tools/code-refactor/codeReuseTool.test.js +0 -572
- package/build/tools/generate-tests/generateBatchScenarioRestTool.test.d.ts +0 -1
- package/build/tools/generate-tests/generateBatchScenarioRestTool.test.js +0 -433
- package/build/tools/generate-tests/generateContractRestTool.test.d.ts +0 -1
- package/build/tools/generate-tests/generateContractRestTool.test.js +0 -142
- package/build/tools/generate-tests/generateIntegrationRestTool.test.d.ts +0 -1
- package/build/tools/generate-tests/generateIntegrationRestTool.test.js +0 -159
- package/build/tools/generate-tests/generateLoadRestTool.test.d.ts +0 -1
- package/build/tools/generate-tests/generateLoadRestTool.test.js +0 -169
- package/build/tools/generate-tests/generateUIRestTool.test.d.ts +0 -1
- package/build/tools/generate-tests/generateUIRestTool.test.js +0 -32
- package/build/tools/generate-tests/planGuard.test.d.ts +0 -1
- package/build/tools/generate-tests/planGuard.test.js +0 -185
- package/build/tools/generate-tests/scenarioLint.test.d.ts +0 -1
- package/build/tools/generate-tests/scenarioLint.test.js +0 -100
- package/build/tools/runExistingTestsTool.test.d.ts +0 -1
- package/build/tools/runExistingTestsTool.test.js +0 -379
- package/build/tools/submitReportTool.test.d.ts +0 -1
- package/build/tools/submitReportTool.test.js +0 -1428
- package/build/tools/test-management/actionsTool.test.d.ts +0 -1
- package/build/tools/test-management/actionsTool.test.js +0 -436
- package/build/tools/test-management/analyzeChangesTool.test.d.ts +0 -1
- package/build/tools/test-management/analyzeChangesTool.test.js +0 -522
- package/build/tools/test-management/analyzeTestHealthTool.test.d.ts +0 -1
- package/build/tools/test-management/analyzeTestHealthTool.test.js +0 -385
- package/build/tools/test-management/registerTestPlanTool.test.d.ts +0 -1
- package/build/tools/test-management/registerTestPlanTool.test.js +0 -296
- package/build/tools/trace/resolveSaveStoragePath.test.d.ts +0 -1
- package/build/tools/trace/resolveSaveStoragePath.test.js +0 -17
- package/build/tools/trace/resolveSessionPaths.test.d.ts +0 -1
- package/build/tools/trace/resolveSessionPaths.test.js +0 -104
- package/build/tools/trace/sessionState.test.d.ts +0 -1
- package/build/tools/trace/sessionState.test.js +0 -17
- package/build/tools/workspace/initializeWorkspaceTool.test.d.ts +0 -1
- package/build/tools/workspace/initializeWorkspaceTool.test.js +0 -139
- package/build/tools/workspace/serviceUpsert.test.d.ts +0 -1
- package/build/tools/workspace/serviceUpsert.test.js +0 -50
- package/build/utils/AnalysisStateManager.test.d.ts +0 -1
- package/build/utils/AnalysisStateManager.test.js +0 -134
- package/build/utils/dartRouteExtractor.test.d.ts +0 -1
- package/build/utils/dartRouteExtractor.test.js +0 -307
- package/build/utils/docker.test.d.ts +0 -1
- package/build/utils/docker.test.js +0 -114
- package/build/utils/featureFlags.test.d.ts +0 -1
- package/build/utils/featureFlags.test.js +0 -81
- package/build/utils/fileWalk.test.d.ts +0 -1
- package/build/utils/fileWalk.test.js +0 -252
- package/build/utils/frontendIntegration.test.d.ts +0 -1
- package/build/utils/frontendIntegration.test.js +0 -229
- package/build/utils/frontendSelectors.test.d.ts +0 -1
- package/build/utils/frontendSelectors.test.js +0 -118
- package/build/utils/gitStaging.test.d.ts +0 -1
- package/build/utils/gitStaging.test.js +0 -111
- package/build/utils/httpDefaults.test.d.ts +0 -1
- package/build/utils/httpDefaults.test.js +0 -21
- package/build/utils/importerHop.test.d.ts +0 -1
- package/build/utils/importerHop.test.js +0 -469
- package/build/utils/pathAffinityClassification.test.d.ts +0 -1
- package/build/utils/pathAffinityClassification.test.js +0 -208
- package/build/utils/planMatchKeys.test.d.ts +0 -1
- package/build/utils/planMatchKeys.test.js +0 -123
- package/build/utils/pom-scope/index.test.d.ts +0 -1
- package/build/utils/pom-scope/index.test.js +0 -278
- package/build/utils/pom-scope/pom-files.test.d.ts +0 -1
- package/build/utils/pom-scope/pom-files.test.js +0 -29
- package/build/utils/pom-scope/scoring.test.d.ts +0 -1
- package/build/utils/pom-scope/scoring.test.js +0 -39
- package/build/utils/pom-scope/selector-extractor.test.d.ts +0 -1
- package/build/utils/pom-scope/selector-extractor.test.js +0 -67
- package/build/utils/pom-verify/bindings.test.d.ts +0 -1
- package/build/utils/pom-verify/bindings.test.js +0 -164
- package/build/utils/pom-verify/calls.test.d.ts +0 -1
- package/build/utils/pom-verify/calls.test.js +0 -61
- package/build/utils/pom-verify/resolve.test.d.ts +0 -1
- package/build/utils/pom-verify/resolve.test.js +0 -114
- package/build/utils/pom-verify/verify.test.d.ts +0 -1
- package/build/utils/pom-verify/verify.test.js +0 -374
- package/build/utils/pr-comment-parser.test.d.ts +0 -1
- package/build/utils/pr-comment-parser.test.js +0 -428
- package/build/utils/progress.test.d.ts +0 -1
- package/build/utils/progress.test.js +0 -37
- package/build/utils/projectMetadata.test.d.ts +0 -1
- package/build/utils/projectMetadata.test.js +0 -172
- package/build/utils/pythonMountPrefixes.test.d.ts +0 -1
- package/build/utils/pythonMountPrefixes.test.js +0 -113
- package/build/utils/repoScanner.test.d.ts +0 -1
- package/build/utils/repoScanner.test.js +0 -190
- package/build/utils/reportVerification.test.d.ts +0 -1
- package/build/utils/reportVerification.test.js +0 -185
- package/build/utils/routeParsers.test.d.ts +0 -1
- package/build/utils/routeParsers.test.js +0 -1011
- package/build/utils/scenarioDrafting.test.d.ts +0 -1
- package/build/utils/scenarioDrafting.test.js +0 -876
- package/build/utils/sourceRouteExtractor.test.d.ts +0 -1
- package/build/utils/sourceRouteExtractor.test.js +0 -738
- package/build/utils/telemetry.test.d.ts +0 -1
- package/build/utils/telemetry.test.js +0 -70
- package/build/utils/trace-parser.test.d.ts +0 -6
- package/build/utils/trace-parser.test.js +0 -140
- package/build/utils/uiPageEnumerator.test.d.ts +0 -1
- package/build/utils/uiPageEnumerator.test.js +0 -824
- package/build/utils/utils.test.d.ts +0 -1
- package/build/utils/utils.test.js +0 -103
- package/build/utils/walkerCharacterization.test.d.ts +0 -1
- package/build/utils/walkerCharacterization.test.js +0 -233
- package/build/utils/workspaceAuth.test.d.ts +0 -1
- package/build/utils/workspaceAuth.test.js +0 -260
- package/build/workspace/testSuites.test.d.ts +0 -1
- package/build/workspace/testSuites.test.js +0 -23
- package/build/workspace/workspace.test.d.ts +0 -1
- package/build/workspace/workspace.test.js +0 -264
|
@@ -1,264 +0,0 @@
|
|
|
1
|
-
import { jest } from "@jest/globals";
|
|
2
|
-
jest.mock("@skyramp/skyramp", () => ({
|
|
3
|
-
WorkspaceConfigManager: { create: jest.fn() },
|
|
4
|
-
}));
|
|
5
|
-
import { buildAnalysisOutputText, getStepTraceCallers, ANALYSIS_STEP_READ_FILES, ANALYSIS_STEP_RESOLVE_PATHS, ANALYSIS_STEP_EXTRACT, ANALYSIS_STEP_DRAFT, ANALYSIS_STEP_CALL_TOOL, } from "./analysisOutputPrompt.js";
|
|
6
|
-
import { AnalysisScope } from "../../types/RepositoryAnalysis.js";
|
|
7
|
-
// ---------------------------------------------------------------------------
|
|
8
|
-
// Minimal fixture factory
|
|
9
|
-
// ---------------------------------------------------------------------------
|
|
10
|
-
function baseParams(overrides = {}) {
|
|
11
|
-
return {
|
|
12
|
-
sessionId: "test-session-id",
|
|
13
|
-
repositoryPath: "/repo",
|
|
14
|
-
analysisScope: AnalysisScope.CurrentBranchDiff,
|
|
15
|
-
scannedEndpoints: [],
|
|
16
|
-
wsBaseUrl: "http://localhost:3000",
|
|
17
|
-
wsAuthHeader: "Authorization",
|
|
18
|
-
wsAuthType: "",
|
|
19
|
-
wsSchemaPath: "",
|
|
20
|
-
routerMountContext: [],
|
|
21
|
-
parsedDiff: {
|
|
22
|
-
changedFiles: [],
|
|
23
|
-
newEndpoints: [],
|
|
24
|
-
modifiedEndpoints: [],
|
|
25
|
-
},
|
|
26
|
-
...overrides,
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
// ---------------------------------------------------------------------------
|
|
30
|
-
// Static step label constants
|
|
31
|
-
// ---------------------------------------------------------------------------
|
|
32
|
-
describe("analysisOutputPrompt — static step label constants", () => {
|
|
33
|
-
it("exports sequential main-step labels", () => {
|
|
34
|
-
expect(ANALYSIS_STEP_READ_FILES).toBe("1");
|
|
35
|
-
expect(ANALYSIS_STEP_EXTRACT).toBe("2");
|
|
36
|
-
expect(ANALYSIS_STEP_DRAFT).toBe("3");
|
|
37
|
-
expect(ANALYSIS_STEP_CALL_TOOL).toBe("4");
|
|
38
|
-
});
|
|
39
|
-
it("exports sequential sub-step label for RESOLVE_PATHS", () => {
|
|
40
|
-
expect(ANALYSIS_STEP_RESOLVE_PATHS).toBe("1.1");
|
|
41
|
-
});
|
|
42
|
-
});
|
|
43
|
-
// ---------------------------------------------------------------------------
|
|
44
|
-
// getStepTraceCallers() — dynamic label for the conditional sub-step
|
|
45
|
-
// ---------------------------------------------------------------------------
|
|
46
|
-
describe("getStepTraceCallers()", () => {
|
|
47
|
-
it("returns '2.1' when non-frontend unmatched backend files are present in diff scope", () => {
|
|
48
|
-
const params = baseParams({
|
|
49
|
-
unmatchedFiles: ["server/helpers/DataUtils.java"],
|
|
50
|
-
});
|
|
51
|
-
expect(getStepTraceCallers(params)).toBe("2.1");
|
|
52
|
-
});
|
|
53
|
-
it("returns null when unmatchedFiles is empty", () => {
|
|
54
|
-
const params = baseParams({ unmatchedFiles: [] });
|
|
55
|
-
expect(getStepTraceCallers(params)).toBeNull();
|
|
56
|
-
});
|
|
57
|
-
it("returns null when unmatchedFiles is undefined", () => {
|
|
58
|
-
const params = baseParams({ unmatchedFiles: undefined });
|
|
59
|
-
expect(getStepTraceCallers(params)).toBeNull();
|
|
60
|
-
});
|
|
61
|
-
it("returns null when scope is full_repo even if unmatchedFiles is non-empty", () => {
|
|
62
|
-
const params = baseParams({
|
|
63
|
-
analysisScope: AnalysisScope.FullRepo,
|
|
64
|
-
unmatchedFiles: ["src/services/SomeService.ts"],
|
|
65
|
-
});
|
|
66
|
-
expect(getStepTraceCallers(params)).toBeNull();
|
|
67
|
-
});
|
|
68
|
-
it("returns null when unmatchedFiles contains only frontend component files", () => {
|
|
69
|
-
const params = baseParams({
|
|
70
|
-
unmatchedFiles: ["src/components/Button.tsx", "src/pages/Dashboard.jsx"],
|
|
71
|
-
});
|
|
72
|
-
expect(getStepTraceCallers(params)).toBeNull();
|
|
73
|
-
});
|
|
74
|
-
it("returns null when unmatchedFiles contains only non-code files", () => {
|
|
75
|
-
const params = baseParams({
|
|
76
|
-
unmatchedFiles: ["README.md", "package.json", "docker-compose.yml"],
|
|
77
|
-
});
|
|
78
|
-
expect(getStepTraceCallers(params)).toBeNull();
|
|
79
|
-
});
|
|
80
|
-
});
|
|
81
|
-
// ---------------------------------------------------------------------------
|
|
82
|
-
// Trace-callers sub-step output (Step 2.1)
|
|
83
|
-
// ---------------------------------------------------------------------------
|
|
84
|
-
describe("buildAnalysisOutputText — unmatchedFiles / trace-callers sub-step", () => {
|
|
85
|
-
it("includes the trace-callers block when unmatchedFiles is non-empty and scope is CurrentBranchDiff", () => {
|
|
86
|
-
const params = baseParams({
|
|
87
|
-
unmatchedFiles: [
|
|
88
|
-
"server/src/main/java/helpers/DataUtils.java",
|
|
89
|
-
"server/src/main/java/helpers/MustacheHelper.java",
|
|
90
|
-
],
|
|
91
|
-
});
|
|
92
|
-
const output = buildAnalysisOutputText(params);
|
|
93
|
-
const label = getStepTraceCallers(params);
|
|
94
|
-
expect(label).not.toBeNull();
|
|
95
|
-
expect(output).toContain(`### Step ${label}: Trace callers of changed non-route files`);
|
|
96
|
-
expect(output).toContain("DataUtils.java");
|
|
97
|
-
expect(output).toContain("MustacheHelper.java");
|
|
98
|
-
expect(output).toContain("/execute");
|
|
99
|
-
});
|
|
100
|
-
it("lists each unmatched file as a bullet in the trace-callers block", () => {
|
|
101
|
-
const params = baseParams({
|
|
102
|
-
unmatchedFiles: ["src/services/OrderService.ts", "src/utils/pricingHelper.ts"],
|
|
103
|
-
});
|
|
104
|
-
const output = buildAnalysisOutputText(params);
|
|
105
|
-
expect(output).toContain("- `src/services/OrderService.ts`");
|
|
106
|
-
expect(output).toContain("- `src/utils/pricingHelper.ts`");
|
|
107
|
-
});
|
|
108
|
-
it("omits the trace-callers block when unmatchedFiles is empty", () => {
|
|
109
|
-
const params = baseParams({ unmatchedFiles: [] });
|
|
110
|
-
const output = buildAnalysisOutputText(params);
|
|
111
|
-
expect(getStepTraceCallers(params)).toBeNull();
|
|
112
|
-
expect(output).not.toContain("Trace callers of changed non-route files");
|
|
113
|
-
});
|
|
114
|
-
it("omits the trace-callers block when unmatchedFiles is undefined", () => {
|
|
115
|
-
const params = baseParams({ unmatchedFiles: undefined });
|
|
116
|
-
const output = buildAnalysisOutputText(params);
|
|
117
|
-
expect(getStepTraceCallers(params)).toBeNull();
|
|
118
|
-
expect(output).not.toContain("Trace callers of changed non-route files");
|
|
119
|
-
});
|
|
120
|
-
it("omits the trace-callers block when scope is full_repo even if unmatchedFiles is non-empty", () => {
|
|
121
|
-
const params = baseParams({
|
|
122
|
-
analysisScope: AnalysisScope.FullRepo,
|
|
123
|
-
unmatchedFiles: ["src/services/SomeService.ts"],
|
|
124
|
-
});
|
|
125
|
-
const output = buildAnalysisOutputText(params);
|
|
126
|
-
expect(getStepTraceCallers(params)).toBeNull();
|
|
127
|
-
expect(output).not.toContain("Trace callers of changed non-route files");
|
|
128
|
-
});
|
|
129
|
-
it("trace-callers sub-step appears after the extract step in the output (phase 4b — no Step 2.5)", () => {
|
|
130
|
-
// This test uses no diff — falls back to the source-files branch.
|
|
131
|
-
const params = baseParams({
|
|
132
|
-
unmatchedFiles: ["src/utils/helper.ts"],
|
|
133
|
-
});
|
|
134
|
-
const output = buildAnalysisOutputText(params);
|
|
135
|
-
const label = getStepTraceCallers(params);
|
|
136
|
-
expect(label).not.toBeNull();
|
|
137
|
-
expect(output).toContain(`Step ${label}`);
|
|
138
|
-
expect(output).not.toContain("Step 2.5");
|
|
139
|
-
});
|
|
140
|
-
it("critical-patterns checklist is present in Step 2 regardless of diff availability (phase 4b)", () => {
|
|
141
|
-
// Step 2.5 was merged into Step 2 — patterns appear inline in ALL diff-scope branches.
|
|
142
|
-
const withDiff = baseParams({ unmatchedFiles: ["src/utils/foo.ts"], diffFilePath: "/tmp/pr.diff" });
|
|
143
|
-
const withDiffNoUnmatched = baseParams({ unmatchedFiles: [], diffFilePath: "/tmp/pr.diff" });
|
|
144
|
-
const noDiff = baseParams({ unmatchedFiles: [] });
|
|
145
|
-
const uiOnly = baseParams({
|
|
146
|
-
parsedDiff: {
|
|
147
|
-
changedFiles: ["src/components/Cart.tsx", "src/components/OrderList.vue"],
|
|
148
|
-
newEndpoints: [],
|
|
149
|
-
modifiedEndpoints: [],
|
|
150
|
-
},
|
|
151
|
-
unmatchedFiles: [],
|
|
152
|
-
});
|
|
153
|
-
expect(buildAnalysisOutputText(withDiff)).toContain("While reading, also note these patterns");
|
|
154
|
-
expect(buildAnalysisOutputText(withDiffNoUnmatched)).toContain("While reading, also note these patterns");
|
|
155
|
-
expect(buildAnalysisOutputText(noDiff)).toContain("While reading, also note these patterns");
|
|
156
|
-
expect(buildAnalysisOutputText(uiOnly)).toContain("While reading, also note these patterns");
|
|
157
|
-
// Step 2.5 header should never appear
|
|
158
|
-
expect(buildAnalysisOutputText(withDiff)).not.toContain("Step 2.5");
|
|
159
|
-
expect(buildAnalysisOutputText(noDiff)).not.toContain("Step 2.5");
|
|
160
|
-
expect(buildAnalysisOutputText(uiOnly)).not.toContain("Step 2.5");
|
|
161
|
-
});
|
|
162
|
-
it("omits trace-callers block when unmatchedFiles contains only frontend component files (UI-only PR)", () => {
|
|
163
|
-
const params = baseParams({
|
|
164
|
-
unmatchedFiles: [
|
|
165
|
-
"src/components/Button.tsx",
|
|
166
|
-
"src/pages/Dashboard.jsx",
|
|
167
|
-
"src/views/UserProfile.vue",
|
|
168
|
-
"src/routes/Settings.svelte",
|
|
169
|
-
],
|
|
170
|
-
});
|
|
171
|
-
const output = buildAnalysisOutputText(params);
|
|
172
|
-
expect(getStepTraceCallers(params)).toBeNull();
|
|
173
|
-
expect(output).not.toContain("Trace callers of changed non-route files");
|
|
174
|
-
});
|
|
175
|
-
it("omits trace-callers block when unmatchedFiles contains only non-code files (docs/config)", () => {
|
|
176
|
-
const params = baseParams({
|
|
177
|
-
unmatchedFiles: [
|
|
178
|
-
"README.md",
|
|
179
|
-
"package.json",
|
|
180
|
-
"docker-compose.yml",
|
|
181
|
-
".github/workflows/ci.yml",
|
|
182
|
-
],
|
|
183
|
-
});
|
|
184
|
-
const output = buildAnalysisOutputText(params);
|
|
185
|
-
expect(getStepTraceCallers(params)).toBeNull();
|
|
186
|
-
expect(output).not.toContain("Trace callers of changed non-route files");
|
|
187
|
-
});
|
|
188
|
-
it("emits trace-callers for backend code files but excludes frontend/non-code siblings", () => {
|
|
189
|
-
// Mixed PR: one Java helper + one React component + one config file.
|
|
190
|
-
// Only the Java file should appear in the trace-callers bullets.
|
|
191
|
-
const params = baseParams({
|
|
192
|
-
unmatchedFiles: [
|
|
193
|
-
"server/helpers/DataUtils.java",
|
|
194
|
-
"client/components/ActionButton.tsx",
|
|
195
|
-
"package.json",
|
|
196
|
-
],
|
|
197
|
-
});
|
|
198
|
-
const output = buildAnalysisOutputText(params);
|
|
199
|
-
const label = getStepTraceCallers(params);
|
|
200
|
-
expect(label).not.toBeNull();
|
|
201
|
-
expect(output).toContain(`Step ${label}`);
|
|
202
|
-
expect(output).toContain("DataUtils.java");
|
|
203
|
-
expect(output).not.toContain("ActionButton.tsx");
|
|
204
|
-
expect(output).not.toContain("package.json");
|
|
205
|
-
});
|
|
206
|
-
it("omits trace-callers when unmatchedFiles contains frontend .ts/.js files and isUIOnly is true", () => {
|
|
207
|
-
// Files in recognized frontend directories (components/, pages/) are classified
|
|
208
|
-
// as frontend by isFrontendFile() — making this a UI-only PR.
|
|
209
|
-
const params = baseParams({
|
|
210
|
-
parsedDiff: {
|
|
211
|
-
changedFiles: ["src/components/AuthForm.ts", "src/pages/LoginPage.ts"],
|
|
212
|
-
newEndpoints: [],
|
|
213
|
-
modifiedEndpoints: [],
|
|
214
|
-
},
|
|
215
|
-
unmatchedFiles: ["src/components/AuthForm.ts", "src/pages/LoginPage.ts"],
|
|
216
|
-
});
|
|
217
|
-
const output = buildAnalysisOutputText(params);
|
|
218
|
-
expect(getStepTraceCallers(params)).toBeNull();
|
|
219
|
-
expect(output).not.toContain("Trace callers of changed non-route files");
|
|
220
|
-
});
|
|
221
|
-
it("does NOT treat backend .ts/.js files as UI-only (directory-aware heuristic)", () => {
|
|
222
|
-
// Files in src/services/ or src/hooks/ are NOT in frontend directories —
|
|
223
|
-
// they should NOT trigger isUIOnly, so trace-callers should fire.
|
|
224
|
-
const params = baseParams({
|
|
225
|
-
parsedDiff: {
|
|
226
|
-
changedFiles: ["src/services/auth.service.ts", "src/hooks/useAuth.ts"],
|
|
227
|
-
newEndpoints: [],
|
|
228
|
-
modifiedEndpoints: [],
|
|
229
|
-
},
|
|
230
|
-
unmatchedFiles: ["src/services/auth.service.ts", "src/hooks/useAuth.ts"],
|
|
231
|
-
});
|
|
232
|
-
const output = buildAnalysisOutputText(params);
|
|
233
|
-
expect(getStepTraceCallers(params)).not.toBeNull();
|
|
234
|
-
expect(output).toContain("Trace callers of changed non-route files");
|
|
235
|
-
});
|
|
236
|
-
});
|
|
237
|
-
describe("buildAnalysisOutputText — scanner fallback", () => {
|
|
238
|
-
it("includes manual endpoint discovery in diff scope when candidate route files are present despite scanned endpoints", () => {
|
|
239
|
-
const params = baseParams({
|
|
240
|
-
analysisScope: AnalysisScope.CurrentBranchDiff,
|
|
241
|
-
scannedEndpoints: [{ path: "/openapi-only", methods: ["GET"], sourceFile: "" }],
|
|
242
|
-
candidateRouteFiles: ["src/routes/items.ts"],
|
|
243
|
-
});
|
|
244
|
-
const output = buildAnalysisOutputText(params);
|
|
245
|
-
expect(output).toContain("Scanner Fallback — Manual Endpoint Discovery Required");
|
|
246
|
-
expect(output).toContain("may have missed route/controller files");
|
|
247
|
-
expect(output).toContain("src/routes/items.ts");
|
|
248
|
-
expect(output).toContain("supplemental gap check");
|
|
249
|
-
expect(output).toContain("keep the existing catalog as the primary endpoint source");
|
|
250
|
-
expect(output).not.toContain("use it as the authoritative endpoint list");
|
|
251
|
-
});
|
|
252
|
-
it("tells fallback discovery not to turn GraphQL artifacts into REST endpoints", () => {
|
|
253
|
-
const params = baseParams({
|
|
254
|
-
analysisScope: AnalysisScope.CurrentBranchDiff,
|
|
255
|
-
scannedEndpoints: [],
|
|
256
|
-
candidateRouteFiles: ["src/graphql/users.resolver.ts"],
|
|
257
|
-
});
|
|
258
|
-
const output = buildAnalysisOutputText(params);
|
|
259
|
-
expect(output).toContain("GraphQL: schema/resolver artifacts are unsupported for REST test generation");
|
|
260
|
-
expect(output).toContain("do not invent REST endpoints from them");
|
|
261
|
-
expect(output).toContain("use it as the authoritative endpoint list");
|
|
262
|
-
expect(output).not.toContain("Query/Mutation resolvers mapping to endpoints");
|
|
263
|
-
});
|
|
264
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
import { jest } from "@jest/globals";
|
|
2
|
-
jest.mock("@skyramp/skyramp", () => ({ Skyramp: class {
|
|
3
|
-
} }));
|
|
4
|
-
import { mergeEnrichedScenarios } from "./registerRecommendTestsPrompt.js";
|
|
5
|
-
import { ScenarioSource } from "../../types/RepositoryAnalysis.js";
|
|
6
|
-
import { TestType } from "../../types/TestTypes.js";
|
|
7
|
-
function makeScenario(overrides = {}) {
|
|
8
|
-
return {
|
|
9
|
-
scenarioName: "base-scenario",
|
|
10
|
-
description: "base",
|
|
11
|
-
category: "crud",
|
|
12
|
-
priority: "medium",
|
|
13
|
-
steps: [{ order: 1, method: "GET", path: "/api/items", description: "list", interactionType: "success", expectedStatusCode: 200 }],
|
|
14
|
-
chainingKeys: [],
|
|
15
|
-
requiresAuth: true,
|
|
16
|
-
estimatedComplexity: "simple",
|
|
17
|
-
source: ScenarioSource.CodeInferred,
|
|
18
|
-
testType: TestType.CONTRACT,
|
|
19
|
-
...overrides,
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
const VALID_STEP = { order: 1, method: "post", path: "/api/orders", expectedStatusCode: 201 };
|
|
23
|
-
describe("mergeEnrichedScenarios — happy path", () => {
|
|
24
|
-
it("merges a valid agent scenario into server scenarios", () => {
|
|
25
|
-
const server = [makeScenario({ scenarioName: "existing" })];
|
|
26
|
-
const raw = JSON.stringify([{
|
|
27
|
-
scenarioName: "new-orders-flow",
|
|
28
|
-
category: "business_rule",
|
|
29
|
-
steps: [VALID_STEP],
|
|
30
|
-
}]);
|
|
31
|
-
const { scenarios, rejectionNotes } = mergeEnrichedScenarios(server, raw);
|
|
32
|
-
expect(rejectionNotes).toHaveLength(0);
|
|
33
|
-
expect(scenarios.find(s => s.scenarioName === "new-orders-flow")).toBeDefined();
|
|
34
|
-
expect(scenarios.find(s => s.scenarioName === "existing")).toBeDefined();
|
|
35
|
-
expect(scenarios).toHaveLength(2);
|
|
36
|
-
});
|
|
37
|
-
it("overrides a server scenario when agent provides same scenarioName", () => {
|
|
38
|
-
const server = [makeScenario({ scenarioName: "orders-flow", description: "server version" })];
|
|
39
|
-
const raw = JSON.stringify([{
|
|
40
|
-
scenarioName: "orders-flow",
|
|
41
|
-
category: "business_rule",
|
|
42
|
-
description: "agent version",
|
|
43
|
-
steps: [VALID_STEP],
|
|
44
|
-
}]);
|
|
45
|
-
const { scenarios } = mergeEnrichedScenarios(server, raw);
|
|
46
|
-
expect(scenarios).toHaveLength(1);
|
|
47
|
-
expect(scenarios[0].description).toBe("agent version");
|
|
48
|
-
expect(scenarios[0].source).toBe("agent-enriched");
|
|
49
|
-
});
|
|
50
|
-
it("normalizes method to uppercase", () => {
|
|
51
|
-
const raw = JSON.stringify([{
|
|
52
|
-
scenarioName: "uppercase-test",
|
|
53
|
-
category: "crud",
|
|
54
|
-
steps: [{ order: 1, method: "post", path: "/api/items", expectedStatusCode: 201 }],
|
|
55
|
-
}]);
|
|
56
|
-
const { scenarios } = mergeEnrichedScenarios([], raw);
|
|
57
|
-
expect(scenarios[0].steps[0].method).toBe("POST");
|
|
58
|
-
});
|
|
59
|
-
it("preserves bugCatchingTarget when provided", () => {
|
|
60
|
-
const raw = JSON.stringify([{
|
|
61
|
-
scenarioName: "formula-test",
|
|
62
|
-
category: "business_rule",
|
|
63
|
-
bugCatchingTarget: "total = price * qty",
|
|
64
|
-
steps: [VALID_STEP],
|
|
65
|
-
}]);
|
|
66
|
-
const { scenarios } = mergeEnrichedScenarios([], raw);
|
|
67
|
-
expect(scenarios[0].bugCatchingTarget).toBe("total = price * qty");
|
|
68
|
-
});
|
|
69
|
-
it("falls back to server scenarios on empty agent array", () => {
|
|
70
|
-
const server = [makeScenario({ scenarioName: "server-only" })];
|
|
71
|
-
const { scenarios, rejectionNotes } = mergeEnrichedScenarios(server, "[]");
|
|
72
|
-
// Empty array → no agent scenarios, return server ones unchanged
|
|
73
|
-
expect(scenarios).toEqual(server);
|
|
74
|
-
expect(rejectionNotes).toHaveLength(0);
|
|
75
|
-
});
|
|
76
|
-
});
|
|
77
|
-
describe("mergeEnrichedScenarios — rejection cases", () => {
|
|
78
|
-
it("rejects scenario with missing scenarioName", () => {
|
|
79
|
-
const raw = JSON.stringify([{ category: "crud", steps: [VALID_STEP] }]);
|
|
80
|
-
const { scenarios, rejectionNotes } = mergeEnrichedScenarios([], raw);
|
|
81
|
-
expect(scenarios).toHaveLength(0);
|
|
82
|
-
expect(rejectionNotes[0]).toMatch(/missing scenarioName/);
|
|
83
|
-
});
|
|
84
|
-
it("rejects scenario with missing steps array", () => {
|
|
85
|
-
const raw = JSON.stringify([{ scenarioName: "no-steps", category: "crud" }]);
|
|
86
|
-
const { rejectionNotes } = mergeEnrichedScenarios([], raw);
|
|
87
|
-
expect(rejectionNotes[0]).toMatch(/missing or empty steps/);
|
|
88
|
-
});
|
|
89
|
-
it("rejects scenario with empty steps array", () => {
|
|
90
|
-
const raw = JSON.stringify([{ scenarioName: "empty-steps", category: "crud", steps: [] }]);
|
|
91
|
-
const { rejectionNotes } = mergeEnrichedScenarios([], raw);
|
|
92
|
-
expect(rejectionNotes[0]).toMatch(/missing or empty steps/);
|
|
93
|
-
});
|
|
94
|
-
it("rejects scenario with missing category", () => {
|
|
95
|
-
const raw = JSON.stringify([{ scenarioName: "no-cat", steps: [VALID_STEP] }]);
|
|
96
|
-
const { rejectionNotes } = mergeEnrichedScenarios([], raw);
|
|
97
|
-
expect(rejectionNotes[0]).toMatch(/missing category/);
|
|
98
|
-
});
|
|
99
|
-
it("rejects scenario with unknown category", () => {
|
|
100
|
-
const raw = JSON.stringify([{ scenarioName: "bad-cat", category: "not_a_real_category", steps: [VALID_STEP] }]);
|
|
101
|
-
const { rejectionNotes } = mergeEnrichedScenarios([], raw);
|
|
102
|
-
expect(rejectionNotes[0]).toMatch(/unknown category/);
|
|
103
|
-
});
|
|
104
|
-
it("falls back to server scenarios on invalid JSON", () => {
|
|
105
|
-
const server = [makeScenario()];
|
|
106
|
-
const { scenarios, rejectionNotes } = mergeEnrichedScenarios(server, "{ bad json");
|
|
107
|
-
expect(scenarios).toEqual(server);
|
|
108
|
-
expect(rejectionNotes[0]).toMatch(/invalid JSON/);
|
|
109
|
-
});
|
|
110
|
-
it("falls back to server scenarios when JSON is not an array", () => {
|
|
111
|
-
const server = [makeScenario()];
|
|
112
|
-
const { scenarios, rejectionNotes } = mergeEnrichedScenarios(server, JSON.stringify({ not: "array" }));
|
|
113
|
-
expect(scenarios).toEqual(server);
|
|
114
|
-
expect(rejectionNotes[0]).toMatch(/expected a JSON array/);
|
|
115
|
-
});
|
|
116
|
-
it("accepts valid scenarios and rejects invalid ones in the same batch", () => {
|
|
117
|
-
const raw = JSON.stringify([
|
|
118
|
-
{ scenarioName: "valid-one", category: "crud", steps: [VALID_STEP] },
|
|
119
|
-
{ category: "crud", steps: [VALID_STEP] }, // missing scenarioName
|
|
120
|
-
]);
|
|
121
|
-
const { scenarios, rejectionNotes } = mergeEnrichedScenarios([], raw);
|
|
122
|
-
expect(scenarios).toHaveLength(1);
|
|
123
|
-
expect(scenarios[0].scenarioName).toBe("valid-one");
|
|
124
|
-
expect(rejectionNotes).toHaveLength(1);
|
|
125
|
-
});
|
|
126
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|