@alternative-path/qa-path-mcp 1.0.0
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/LICENSE +23 -0
- package/QUICK_INSTALL.md +133 -0
- package/README.md +226 -0
- package/TOOLS_DOCUMENTATION.md +675 -0
- package/dist/__tests__/tools/module-tools.test.d.ts +2 -0
- package/dist/__tests__/tools/module-tools.test.d.ts.map +1 -0
- package/dist/__tests__/tools/module-tools.test.js +145 -0
- package/dist/__tests__/tools/module-tools.test.js.map +1 -0
- package/dist/__tests__/tools/project-tools.test.d.ts +2 -0
- package/dist/__tests__/tools/project-tools.test.d.ts.map +1 -0
- package/dist/__tests__/tools/project-tools.test.js +674 -0
- package/dist/__tests__/tools/project-tools.test.js.map +1 -0
- package/dist/__tests__/tools/query-tools.test.d.ts +2 -0
- package/dist/__tests__/tools/query-tools.test.d.ts.map +1 -0
- package/dist/__tests__/tools/query-tools.test.js +225 -0
- package/dist/__tests__/tools/query-tools.test.js.map +1 -0
- package/dist/__tests__/tools/testgroup-launch-tools.test.d.ts +2 -0
- package/dist/__tests__/tools/testgroup-launch-tools.test.d.ts.map +1 -0
- package/dist/__tests__/tools/testgroup-launch-tools.test.js +553 -0
- package/dist/__tests__/tools/testgroup-launch-tools.test.js.map +1 -0
- package/dist/__tests__/utils/mcp-error-mapper.test.d.ts +2 -0
- package/dist/__tests__/utils/mcp-error-mapper.test.d.ts.map +1 -0
- package/dist/__tests__/utils/mcp-error-mapper.test.js +240 -0
- package/dist/__tests__/utils/mcp-error-mapper.test.js.map +1 -0
- package/dist/__tests__/utils/mcp-response.test.d.ts +2 -0
- package/dist/__tests__/utils/mcp-response.test.d.ts.map +1 -0
- package/dist/__tests__/utils/mcp-response.test.js +72 -0
- package/dist/__tests__/utils/mcp-response.test.js.map +1 -0
- package/dist/agents/test-planner-context.d.ts +7 -0
- package/dist/agents/test-planner-context.d.ts.map +1 -0
- package/dist/agents/test-planner-context.js +283 -0
- package/dist/agents/test-planner-context.js.map +1 -0
- package/dist/agents/test-planner-prompt.d.ts +34 -0
- package/dist/agents/test-planner-prompt.d.ts.map +1 -0
- package/dist/agents/test-planner-prompt.js +82 -0
- package/dist/agents/test-planner-prompt.js.map +1 -0
- package/dist/api-client.d.ts +52 -0
- package/dist/api-client.d.ts.map +1 -0
- package/dist/api-client.js +285 -0
- package/dist/api-client.js.map +1 -0
- package/dist/constants.d.ts +7 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +7 -0
- package/dist/constants.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +175 -0
- package/dist/index.js.map +1 -0
- package/dist/services/project-context-service.d.ts +15 -0
- package/dist/services/project-context-service.d.ts.map +1 -0
- package/dist/services/project-context-service.js +36 -0
- package/dist/services/project-context-service.js.map +1 -0
- package/dist/tools/auth-tools.d.ts +16 -0
- package/dist/tools/auth-tools.d.ts.map +1 -0
- package/dist/tools/auth-tools.js +66 -0
- package/dist/tools/auth-tools.js.map +1 -0
- package/dist/tools/automation-tools.d.ts +28 -0
- package/dist/tools/automation-tools.d.ts.map +1 -0
- package/dist/tools/automation-tools.js +541 -0
- package/dist/tools/automation-tools.js.map +1 -0
- package/dist/tools/export-import-tools.d.ts +18 -0
- package/dist/tools/export-import-tools.d.ts.map +1 -0
- package/dist/tools/export-import-tools.js +61 -0
- package/dist/tools/export-import-tools.js.map +1 -0
- package/dist/tools/module-tools.d.ts +43 -0
- package/dist/tools/module-tools.d.ts.map +1 -0
- package/dist/tools/module-tools.js +289 -0
- package/dist/tools/module-tools.js.map +1 -0
- package/dist/tools/project-context-tools.d.ts +19 -0
- package/dist/tools/project-context-tools.d.ts.map +1 -0
- package/dist/tools/project-context-tools.js +133 -0
- package/dist/tools/project-context-tools.js.map +1 -0
- package/dist/tools/project-tools.d.ts +47 -0
- package/dist/tools/project-tools.d.ts.map +1 -0
- package/dist/tools/project-tools.js +362 -0
- package/dist/tools/project-tools.js.map +1 -0
- package/dist/tools/query-tools.d.ts +22 -0
- package/dist/tools/query-tools.d.ts.map +1 -0
- package/dist/tools/query-tools.js +127 -0
- package/dist/tools/query-tools.js.map +1 -0
- package/dist/tools/testcase-tools.d.ts +135 -0
- package/dist/tools/testcase-tools.d.ts.map +1 -0
- package/dist/tools/testcase-tools.js +845 -0
- package/dist/tools/testcase-tools.js.map +1 -0
- package/dist/tools/testgroup-launch-tools.d.ts +37 -0
- package/dist/tools/testgroup-launch-tools.d.ts.map +1 -0
- package/dist/tools/testgroup-launch-tools.js +727 -0
- package/dist/tools/testgroup-launch-tools.js.map +1 -0
- package/dist/utils/mcp-error-mapper.d.ts +27 -0
- package/dist/utils/mcp-error-mapper.d.ts.map +1 -0
- package/dist/utils/mcp-error-mapper.js +79 -0
- package/dist/utils/mcp-error-mapper.js.map +1 -0
- package/dist/utils/mcp-response.d.ts +26 -0
- package/dist/utils/mcp-response.d.ts.map +1 -0
- package/dist/utils/mcp-response.js +34 -0
- package/dist/utils/mcp-response.js.map +1 -0
- package/package.json +60 -0
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import { mapApiErrorToMcpResponse, mapApiResponseToMcpError, } from "../../utils/mcp-error-mapper.js";
|
|
2
|
+
describe("mcp-error-mapper", () => {
|
|
3
|
+
describe("mapApiErrorToMcpResponse", () => {
|
|
4
|
+
it("should return null for errors without response (network errors)", () => {
|
|
5
|
+
const err = { message: "Network error" };
|
|
6
|
+
const result = mapApiErrorToMcpResponse(err, "FALLBACK");
|
|
7
|
+
expect(result).toBeNull();
|
|
8
|
+
});
|
|
9
|
+
it("should return null for 5xx errors (infrastructure failures)", () => {
|
|
10
|
+
const err = {
|
|
11
|
+
response: {
|
|
12
|
+
status: 500,
|
|
13
|
+
data: { error: "Internal server error" },
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
const result = mapApiErrorToMcpResponse(err, "FALLBACK");
|
|
17
|
+
expect(result).toBeNull();
|
|
18
|
+
});
|
|
19
|
+
it("should map 400 to BAD_REQUEST", () => {
|
|
20
|
+
const err = {
|
|
21
|
+
response: {
|
|
22
|
+
status: 400,
|
|
23
|
+
data: { message: "Invalid request data" },
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
const result = mapApiErrorToMcpResponse(err, "FALLBACK");
|
|
27
|
+
expect(result).not.toBeNull();
|
|
28
|
+
const parsed = JSON.parse(result.content[0].text);
|
|
29
|
+
expect(parsed.success).toBe(false);
|
|
30
|
+
expect(parsed.error_code).toBe("BAD_REQUEST");
|
|
31
|
+
expect(parsed.message).toBe("Invalid request data");
|
|
32
|
+
});
|
|
33
|
+
it("should map 403 to FORBIDDEN", () => {
|
|
34
|
+
const err = {
|
|
35
|
+
response: {
|
|
36
|
+
status: 403,
|
|
37
|
+
data: { message: "Permission denied" },
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
const result = mapApiErrorToMcpResponse(err, "FALLBACK");
|
|
41
|
+
expect(result).not.toBeNull();
|
|
42
|
+
const parsed = JSON.parse(result.content[0].text);
|
|
43
|
+
expect(parsed.error_code).toBe("FORBIDDEN");
|
|
44
|
+
});
|
|
45
|
+
it("should map 404 to NOT_FOUND", () => {
|
|
46
|
+
const err = {
|
|
47
|
+
response: {
|
|
48
|
+
status: 404,
|
|
49
|
+
data: { message: "Resource not found" },
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
const result = mapApiErrorToMcpResponse(err, "FALLBACK");
|
|
53
|
+
expect(result).not.toBeNull();
|
|
54
|
+
const parsed = JSON.parse(result.content[0].text);
|
|
55
|
+
expect(parsed.error_code).toBe("NOT_FOUND");
|
|
56
|
+
});
|
|
57
|
+
it("should map 409 to CONFLICT", () => {
|
|
58
|
+
const err = {
|
|
59
|
+
response: {
|
|
60
|
+
status: 409,
|
|
61
|
+
data: { message: "Duplicate entry" },
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
const result = mapApiErrorToMcpResponse(err, "FALLBACK");
|
|
65
|
+
expect(result).not.toBeNull();
|
|
66
|
+
const parsed = JSON.parse(result.content[0].text);
|
|
67
|
+
expect(parsed.error_code).toBe("CONFLICT");
|
|
68
|
+
});
|
|
69
|
+
it("should use code field from error data if present", () => {
|
|
70
|
+
const err = {
|
|
71
|
+
response: {
|
|
72
|
+
status: 409,
|
|
73
|
+
data: { code: "DUPLICATE_NAME", message: "Name already exists" },
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
const result = mapApiErrorToMcpResponse(err, "FALLBACK");
|
|
77
|
+
expect(result).not.toBeNull();
|
|
78
|
+
const parsed = JSON.parse(result.content[0].text);
|
|
79
|
+
expect(parsed.error_code).toBe("DUPLICATE_NAME");
|
|
80
|
+
});
|
|
81
|
+
it("should map 422 to VALIDATION_FAILED", () => {
|
|
82
|
+
const err = {
|
|
83
|
+
response: {
|
|
84
|
+
status: 422,
|
|
85
|
+
data: { message: "Validation failed" },
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
const result = mapApiErrorToMcpResponse(err, "FALLBACK");
|
|
89
|
+
expect(result).not.toBeNull();
|
|
90
|
+
const parsed = JSON.parse(result.content[0].text);
|
|
91
|
+
expect(parsed.error_code).toBe("VALIDATION_FAILED");
|
|
92
|
+
});
|
|
93
|
+
it("should map unknown 4xx status to REQUEST_FAILED", () => {
|
|
94
|
+
const err = {
|
|
95
|
+
response: {
|
|
96
|
+
status: 418,
|
|
97
|
+
data: { message: "I'm a teapot" },
|
|
98
|
+
},
|
|
99
|
+
};
|
|
100
|
+
const result = mapApiErrorToMcpResponse(err, "FALLBACK");
|
|
101
|
+
expect(result).not.toBeNull();
|
|
102
|
+
const parsed = JSON.parse(result.content[0].text);
|
|
103
|
+
expect(parsed.error_code).toBe("REQUEST_FAILED");
|
|
104
|
+
});
|
|
105
|
+
it("should extract message from error field if message not present", () => {
|
|
106
|
+
const err = {
|
|
107
|
+
response: {
|
|
108
|
+
status: 400,
|
|
109
|
+
data: { error: "Error message" },
|
|
110
|
+
},
|
|
111
|
+
};
|
|
112
|
+
const result = mapApiErrorToMcpResponse(err, "FALLBACK");
|
|
113
|
+
expect(result).not.toBeNull();
|
|
114
|
+
const parsed = JSON.parse(result.content[0].text);
|
|
115
|
+
expect(parsed.message).toBe("Error message");
|
|
116
|
+
});
|
|
117
|
+
it("should use err.message as fallback if no data fields", () => {
|
|
118
|
+
const err = {
|
|
119
|
+
response: {
|
|
120
|
+
status: 400,
|
|
121
|
+
data: {},
|
|
122
|
+
},
|
|
123
|
+
message: "Request failed",
|
|
124
|
+
};
|
|
125
|
+
const result = mapApiErrorToMcpResponse(err, "FALLBACK");
|
|
126
|
+
expect(result).not.toBeNull();
|
|
127
|
+
const parsed = JSON.parse(result.content[0].text);
|
|
128
|
+
expect(parsed.message).toBe("Request failed");
|
|
129
|
+
});
|
|
130
|
+
it("should propagate errors array if present", () => {
|
|
131
|
+
const err = {
|
|
132
|
+
response: {
|
|
133
|
+
status: 400,
|
|
134
|
+
data: {
|
|
135
|
+
message: "Validation failed",
|
|
136
|
+
errors: [
|
|
137
|
+
{ field: "name", message: "Name is required" },
|
|
138
|
+
{ field: "prefix", message: "Prefix is invalid" },
|
|
139
|
+
],
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
};
|
|
143
|
+
const result = mapApiErrorToMcpResponse(err, "FALLBACK");
|
|
144
|
+
expect(result).not.toBeNull();
|
|
145
|
+
const parsed = JSON.parse(result.content[0].text);
|
|
146
|
+
expect(parsed.errors).toHaveLength(2);
|
|
147
|
+
expect(parsed.errors[0].field).toBe("name");
|
|
148
|
+
});
|
|
149
|
+
it("should use fallback error code if unable to derive", () => {
|
|
150
|
+
const err = {
|
|
151
|
+
response: {
|
|
152
|
+
status: 499, // Unknown status
|
|
153
|
+
data: {},
|
|
154
|
+
},
|
|
155
|
+
};
|
|
156
|
+
const result = mapApiErrorToMcpResponse(err, "CUSTOM_FALLBACK");
|
|
157
|
+
expect(result).not.toBeNull();
|
|
158
|
+
const parsed = JSON.parse(result.content[0].text);
|
|
159
|
+
expect(parsed.error_code).toBe("REQUEST_FAILED");
|
|
160
|
+
});
|
|
161
|
+
});
|
|
162
|
+
describe("mapApiResponseToMcpError", () => {
|
|
163
|
+
it("should return null when success is not false", () => {
|
|
164
|
+
const apiResult = { success: true, data: {} };
|
|
165
|
+
const result = mapApiResponseToMcpError(apiResult, "FALLBACK");
|
|
166
|
+
expect(result).toBeNull();
|
|
167
|
+
});
|
|
168
|
+
it("should return null when success is undefined", () => {
|
|
169
|
+
const apiResult = { data: {} };
|
|
170
|
+
const result = mapApiResponseToMcpError(apiResult, "FALLBACK");
|
|
171
|
+
expect(result).toBeNull();
|
|
172
|
+
});
|
|
173
|
+
it("should return error response when success is false", () => {
|
|
174
|
+
const apiResult = {
|
|
175
|
+
success: false,
|
|
176
|
+
message: "Operation failed",
|
|
177
|
+
};
|
|
178
|
+
const result = mapApiResponseToMcpError(apiResult, "FALLBACK");
|
|
179
|
+
expect(result).not.toBeNull();
|
|
180
|
+
const parsed = JSON.parse(result.content[0].text);
|
|
181
|
+
expect(parsed.success).toBe(false);
|
|
182
|
+
expect(parsed.message).toBe("Operation failed");
|
|
183
|
+
});
|
|
184
|
+
it("should use code field from response if present", () => {
|
|
185
|
+
const apiResult = {
|
|
186
|
+
success: false,
|
|
187
|
+
code: "CONFLICT",
|
|
188
|
+
message: "Duplicate entry",
|
|
189
|
+
};
|
|
190
|
+
const result = mapApiResponseToMcpError(apiResult, "FALLBACK");
|
|
191
|
+
expect(result).not.toBeNull();
|
|
192
|
+
const parsed = JSON.parse(result.content[0].text);
|
|
193
|
+
expect(parsed.error_code).toBe("CONFLICT");
|
|
194
|
+
});
|
|
195
|
+
it("should use fallback error code if code not present", () => {
|
|
196
|
+
const apiResult = {
|
|
197
|
+
success: false,
|
|
198
|
+
message: "Operation failed",
|
|
199
|
+
};
|
|
200
|
+
const result = mapApiResponseToMcpError(apiResult, "CUSTOM_FALLBACK");
|
|
201
|
+
expect(result).not.toBeNull();
|
|
202
|
+
const parsed = JSON.parse(result.content[0].text);
|
|
203
|
+
expect(parsed.error_code).toBe("REQUEST_FAILED");
|
|
204
|
+
});
|
|
205
|
+
it("should extract message from error field if message not present", () => {
|
|
206
|
+
const apiResult = {
|
|
207
|
+
success: false,
|
|
208
|
+
error: "Error occurred",
|
|
209
|
+
};
|
|
210
|
+
const result = mapApiResponseToMcpError(apiResult, "FALLBACK");
|
|
211
|
+
expect(result).not.toBeNull();
|
|
212
|
+
const parsed = JSON.parse(result.content[0].text);
|
|
213
|
+
expect(parsed.message).toBe("Error occurred");
|
|
214
|
+
});
|
|
215
|
+
it("should use default message if neither message nor error present", () => {
|
|
216
|
+
const apiResult = {
|
|
217
|
+
success: false,
|
|
218
|
+
};
|
|
219
|
+
const result = mapApiResponseToMcpError(apiResult, "FALLBACK");
|
|
220
|
+
expect(result).not.toBeNull();
|
|
221
|
+
const parsed = JSON.parse(result.content[0].text);
|
|
222
|
+
expect(parsed.message).toBe("Request failed");
|
|
223
|
+
});
|
|
224
|
+
it("should propagate errors array if present", () => {
|
|
225
|
+
const apiResult = {
|
|
226
|
+
success: false,
|
|
227
|
+
message: "Validation failed",
|
|
228
|
+
errors: [
|
|
229
|
+
{ field: "name", message: "Name is required" },
|
|
230
|
+
],
|
|
231
|
+
};
|
|
232
|
+
const result = mapApiResponseToMcpError(apiResult, "FALLBACK");
|
|
233
|
+
expect(result).not.toBeNull();
|
|
234
|
+
const parsed = JSON.parse(result.content[0].text);
|
|
235
|
+
expect(parsed.errors).toHaveLength(1);
|
|
236
|
+
expect(parsed.errors[0].field).toBe("name");
|
|
237
|
+
});
|
|
238
|
+
});
|
|
239
|
+
});
|
|
240
|
+
//# sourceMappingURL=mcp-error-mapper.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-error-mapper.test.js","sourceRoot":"","sources":["../../../src/__tests__/utils/mcp-error-mapper.test.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EACxB,wBAAwB,G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CAAC;YAC9B,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,MAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;YACnD,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAChD,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,0CAA0C,EAAE,GAAG,EAAE;YAClD,MAAM,SAAS,GAAG;gBAChB,OAAO,EAAE,KAAK;gBACd,OAAO,EAAE,mBAAmB;gBAC5B,MAAM,EAAE;oBACN,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,kBAAkB,EAAE;iBAC/C;aACF,CAAC;YACF,MAAM,MAAM,GAAG,wBAAwB,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;YAE/D,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;YAC9B,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,MAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;YACnD,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;YACtC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC9C,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-response.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/utils/mcp-response.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { jsonResponse, textResponse } from "../../utils/mcp-response.js";
|
|
2
|
+
describe("mcp-response", () => {
|
|
3
|
+
describe("jsonResponse", () => {
|
|
4
|
+
it("should return correct MCP response structure", () => {
|
|
5
|
+
const result = jsonResponse({ success: true, message: "Test" });
|
|
6
|
+
expect(result).toHaveProperty("content");
|
|
7
|
+
expect(result.content).toHaveLength(1);
|
|
8
|
+
expect(result.content[0]).toHaveProperty("type", "text");
|
|
9
|
+
expect(result.content[0]).toHaveProperty("text");
|
|
10
|
+
});
|
|
11
|
+
it("should stringify object with proper formatting", () => {
|
|
12
|
+
const obj = { success: true, message: "Test", data: { id: 1 } };
|
|
13
|
+
const result = jsonResponse(obj);
|
|
14
|
+
const parsed = JSON.parse(result.content[0].text);
|
|
15
|
+
expect(parsed).toEqual(obj);
|
|
16
|
+
});
|
|
17
|
+
it("should format JSON with 2-space indentation", () => {
|
|
18
|
+
const obj = { success: true, data: { nested: { value: "test" } } };
|
|
19
|
+
const result = jsonResponse(obj);
|
|
20
|
+
const text = result.content[0].text;
|
|
21
|
+
expect(text).toContain(" "); // 2-space indentation
|
|
22
|
+
expect(text).toMatch(/\n\s{2}"success"/); // Proper indentation
|
|
23
|
+
});
|
|
24
|
+
it("should handle empty objects", () => {
|
|
25
|
+
const result = jsonResponse({});
|
|
26
|
+
expect(result.content[0].text).toBe("{}");
|
|
27
|
+
});
|
|
28
|
+
it("should handle objects with null values", () => {
|
|
29
|
+
const obj = { data: null, message: "test" };
|
|
30
|
+
const result = jsonResponse(obj);
|
|
31
|
+
const parsed = JSON.parse(result.content[0].text);
|
|
32
|
+
expect(parsed.data).toBeNull();
|
|
33
|
+
});
|
|
34
|
+
it("should handle arrays", () => {
|
|
35
|
+
const obj = { items: [1, 2, 3] };
|
|
36
|
+
const result = jsonResponse(obj);
|
|
37
|
+
const parsed = JSON.parse(result.content[0].text);
|
|
38
|
+
expect(parsed.items).toEqual([1, 2, 3]);
|
|
39
|
+
});
|
|
40
|
+
it("should handle complex nested structures", () => {
|
|
41
|
+
const obj = {
|
|
42
|
+
success: true,
|
|
43
|
+
data: {
|
|
44
|
+
user: {
|
|
45
|
+
id: "123",
|
|
46
|
+
name: "Test User",
|
|
47
|
+
roles: ["admin", "user"],
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
errors: null,
|
|
51
|
+
};
|
|
52
|
+
const result = jsonResponse(obj);
|
|
53
|
+
const parsed = JSON.parse(result.content[0].text);
|
|
54
|
+
expect(parsed).toEqual(obj);
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
describe("textResponse", () => {
|
|
58
|
+
it("should return correct MCP response structure", () => {
|
|
59
|
+
const result = textResponse("Hello world");
|
|
60
|
+
expect(result).toHaveProperty("content");
|
|
61
|
+
expect(result.content).toHaveLength(1);
|
|
62
|
+
expect(result.content[0]).toHaveProperty("type", "text");
|
|
63
|
+
expect(result.content[0].text).toBe("Hello world");
|
|
64
|
+
});
|
|
65
|
+
it("should pass through markdown or pre-formatted text unchanged", () => {
|
|
66
|
+
const markdown = "**Summary**\n\n<details>\n<summary>JSON</summary>\n```json\n{}\n```\n</details>";
|
|
67
|
+
const result = textResponse(markdown);
|
|
68
|
+
expect(result.content[0].text).toBe(markdown);
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
//# sourceMappingURL=mcp-response.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-response.test.js","sourceRoot":"","sources":["../../../src/__tests__/utils/mcp-response.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEzE,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;IAC5B,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;QAC5B,EAAE,CAAC,8CAA8C,EAAE,GAAG,EAAE;YACtD,MAAM,MAAM,GAAG,YAAY,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;YAEhE,MAAM,CAAC,MAAM,CAAC,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;YACzC,MAAM,CAAC,MAAM,CAA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7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Embedded test planning context for the x-test-planner agent.
|
|
3
|
+
* This content is the same as CURSOR_CONTEXT_TEST_PLANNING.md but is bundled
|
|
4
|
+
* in the MCP server so the agent always uses a consistent, non-editable context.
|
|
5
|
+
*/
|
|
6
|
+
export declare const TEST_PLANNER_CONTEXT = "# Cursor Context for Test Planning\n\nThis file provides a comprehensive, reusable context for test planning, test case/scenario creation, and automation workflow design. Use this as a template for any new project or feature to ensure consistency, completeness, and efficiency in your QA process.\n\n---\n\n## 1. Test Plan Structure\n\nA standard test plan should include the following sections:\n\n- **Reference Template:**\n - Use your organization's standard test plan template (e.g. Confluence or internal wiki) as a reference for section structure and best practices.\n\n- **Project & Stakeholder Details**\n - QA start dates, stakeholders, design/epic/BDD links, QA owner\n- **Objective**\n - Short summary of the project/feature and underlying changes\n- **Test Scope**\n - In Scope: Features, platforms, workflows to be tested\n - Out of Scope: Exclusions, legacy flows, non-impacted areas\n - In Scope - Automation: What will be automated\n - Out of Scope - Automation: What will not be automated and why\n- **Data Validation Coverage**\n - Types of data, edge cases, negative data, and how data coverage is ensured\n- **Assumptions and Dependencies**\n - Environment, APIs, roles, external systems, etc.\n- **Objectives**\n - Functional, performance, security, UI/UX, data validation\n- **Test Strategy**\n - Types of testing (unit, functional, UI, API, DB, performance, UAT, etc.)\n - Approach: Happy path, edge/negative, integration, data, exploratory\n- **Phase Plan**\n - Phased approach to testing (happy path, integration, edge, regression, etc.)\n- **Manual & Automated Testing**\n - What will be covered manually vs. automated\n- **Migration/Backfilling**\n - Data migration/validation if applicable\n- **Regression**\n - Impacted areas, regression suite, integration points\n- **Functional Testing Considerations**\n - Business rules, UI/UX, data, error handling, new/changed workflows\n- **Integration & Dependencies**\n - APIs, external systems, user management, logging\n- **Non-Functional Testing**\n - Performance, security, compatibility, scalability\n- **Automation & Test Coverage**\n - Reuse, prioritization, data, coverage goals\n- **Operational & Monitoring**\n - Audit logs, error monitoring, post-release validation\n- **User Scenarios & Test Cases**\n - Table of detailed test cases and scenarios\n- **Automation Workflows**\n - Table of automation flows covering multiple test cases\n- **Release and Revert Plan**\n- **Post Release Production Validation**\n- **Approval Table**\n\n---\n\n## 2. Test Case & Scenario Writing\n\n- **Test Case Table Columns:**\n - Test Case ID\n - Title\n - Objective\n - Steps (detailed, step-by-step)\n - Expected Result\n - Test Data (if applicable)\n\n- **Best Practices:**\n - Be specific and unambiguous\n - Cover both positive and negative scenarios\n - Include cases that are most likely to result into bugs\n - Include edge cases and data variations\n - Link to requirements/user stories where possible\n - Use clear, actionable language\n - Be as detailed as possible\n - Define the test steps with granularity and details\n - Include places to look out for in the expected results and be very specific.\n - If there are multiple places where an outcome can be or should be validated, include all those places as part of the expected result or create new test case for that.\n - While creating test cases add test steps as well keeping in mind that the person executing these testacses and steps can only access the application using the front-end. So, add steps that can be followed from the applicaiton/navigation. Try to be as accurate with the test steps as you can.\n\n- **Example Test Case Table (Markdown):**\n\n| Test Case ID | Title | Objective | Steps | Expected Result | Test Data |\n|--------------|-------|-----------|-------|----------------|-----------|\n| TC-01 | Upload Supported Document | Verify upload and queueing of supported document types | 1. Login as user<br>2. Upload Termsheet.pdf<br>3. Queue for extraction | Document appears in dashboard with correct status and metadata | Termsheet.pdf |\n\n---\n\n## 3. Automation Workflow Design\n\n- **Workflow Table Columns:**\n - Workflow Name\n - Test Cases Covered (from the list of test cases generated in above sections)\n - Workflow Steps (should cover multiple test cases per flow)\n\n- **Best Practices:**\n - Design workflows to maximize coverage with minimal complexity\n - Avoid overly complex flows; keep steps maintainable\n - Reuse login, navigation, and setup steps\n - Validate both UI and backend (API, DB) where possible\n\n- **Example Automation Workflow Table (Markdown):**\n\n| Workflow Name | Test Cases Covered | Workflow Steps |\n|--------------|--------------------|----------------|\n| Document Upload, Extraction, and Review | TC-01, TC-03, TC-04, ... | 1. Login<br>2. Upload document<br>3. Queue for extraction<br>... |\n\n---\n\n## 4. Test Data Management\n\n- Use a variety of data: valid, invalid, edge, corrupted, large/small, etc.\n- Document test data in the test case table or as a separate section\n- For automation, use data-driven approaches where possible\n\n---\n\n## 5. General Best Practices\n\n- Always link test cases to requirements/user stories/epics\n- Keep test cases atomic and independent\n- Regularly review and update test cases and workflows\n- Prioritize automation for repetitive, high-value, and regression scenarios\n- Ensure auditability and traceability (who tested what, when, and why)\n- Include negative, boundary, and exploratory tests\n- Validate error handling, security, and access control\n- Document assumptions, dependencies, and environment details\n\n---\n\n## 6. Example Section Templates\n\n### Test Case Table\n\n| Test Case ID | Title | Objective | Steps | Expected Result | Test Data |\n|--------------|-------|-----------|-------|----------------|-----------|\n| TC-01 | ... | ... | ... | ... | ... |\n\n### Automation Workflow Table\n\n| Workflow Name | Test Cases Covered | Workflow Steps |\n|---------------|-------------------|----------------|\n| ... | ... | ... |\n\n---\n\n## 7. Section for Abbreviations\n\n### Abbreviations\n - Include a section towards the end to have abbreviations and their full forms listed\n - List the abbreviations as bullet points\n - If you are you not able to find a full form for any abbreviation, the use the confluence or the internet to search for that term\n\n- **Example Abbreviation Section:**\nPCDO - Private Credit and Deal Orientation\nCLO - Collateralized Loan Obligation\n\n---\n\n## 8. How to Use This Context\n\n- When starting a new test planning effort, use this as your base context\n- Fill in project-specific details, requirements, and data as needed\n- Use the tables and best practices to guide your test plan, test case, and automation workflow creation\n- Make use of the details provided with the prompt\n- **If additional information is provided with the prompt (such as BDD links, TDD links, JIRA story/task links, or Confluence links), ensure you utilize this information by thoroughly reviewing all referenced artifacts. This includes:**\n - Visiting all provided BDD, TDD, JIRA, and Confluence links.\n - For Confluence pages, review all child pages and any referenced or linked Confluence pages.\n - For JIRA artifacts, review all linked JIRA issues and any referenced Confluence pages.\n - Read all comments on both Confluence and JIRA items.\n - Follow all references recursively to ensure complete context is gathered for the test plan.\n\n---\n\n## 8A. Test Planning Deep-Dive Checklist\n\n**When preparing the Test Plan, Test Cases, Testing Strategy, or any other relevant section, use the following checklist to guide your analysis. Answer as many of these as are applicable, and use the answers to enrich the relevant sections of your test plan.**\n\n### Functional Testing\n1. Does the design/change affect the current workflow that it is being developed for?\n2. Does the design/change affect any other transaction?\n - List of affected transactions\n3. Does the design/change affect any existing report/calculation?\n4. List of affected reports/calculations\n5. Is there a need to create separate reporting for the design/change?\n6. Is there any existing data point that could be affected?\n7. Does it affect any other functionality?\n - List of affected functionalities\n8. Are there any new business rules or validations introduced?\n9. How should the system behave in case of missing/invalid data?\n10. Are there any UI/UX changes? If yes, how do they impact usability?\n11. What are the expected inputs and outputs for each function or transaction?\n\n### Integration & Dependencies\n1. Any integration area affected?\n2. List of affected integration areas\n3. Does the change introduce any dependencies on third-party services or external systems?\n4. Are there any upstream or downstream data dependencies?\n5. Do any existing integrations require modification or additional validation?\n6. Are there any database schema changes? If yes, how will backward compatibility be handled?\n\n### Non-Functional Testing\n1. What are the performance benchmarks/considerations?\n2. How much time is allowed during processing?\n3. What are the payload size considerations?\n4. Are there security considerations (authentication, authorization, data encryption)?\n5. What are the scalability and concurrency requirements?\n6. Does the system handle expected and unexpected failures gracefully?\n7. Is failover or disaster recovery testing required?\n8. Are there any regulatory or compliance requirements?\n9. Are there browser/device compatibility considerations (for web or mobile applications)?\n\n### Automation & Test Coverage\n1. Are there reusable test cases from previous releases that apply to this change?\n2. Are there specific scenarios that should be prioritized for automation?\n3. What test data is required, and how will it be managed?\n4. Will exploratory testing be needed in addition to scripted test cases?\n5. Are API endpoints available for testing/automation?\n\n### Operational & Monitoring\n1. Are debug/audit logs available?\n2. How will errors be logged and monitored in production?\n3. Are there any alerting mechanisms in place for failures?\n4. What are the rollback procedures if the deployment fails?\n5. How will post-production validation be performed?\n6. What is the frequency of jobs run?\n7. What access/rights are required for QA teams?\n8. Is there a need for specific capabilities/entitlements for testing?\n\n---\n\n- **Test Strategy**\n - Types of testing (unit, functional, UI, API, DB, performance, UAT, etc.)\n - Approach: Happy path, edge/negative, integration, data, exploratory\n - **Sample Test Strategy (for inspiration):**\n\n We will start with the happy flow scenarios for the Transaction management. Here we plan to cover 65-70% of our functional requirements. Then we will move on to test the migrated data testing that will be performed at the Database layer. As migration is a major event in the functionality to be available to the users. This is critical to do as existing transaction need to be present in the system. Then, we will test integration areas such that the consumers of the transactional data are in sync with the changing transactions, for this API testing approach will be used as the integration will be done using APIs. This strategy ensures that the we have confidence in the end-to end functional, data and integration areas.\n\n Then, we will move on to covering the edge case scenarios around the transaction management, which are more prone to break the workflow. This phase is to make sure the system is resilient to failures and error.\n\n Finally, we will perform exploratory testing to uncover issues or perform validations to ensure completeness.\n\n **Phase 1: Happy Flow Validation (Foundation Testing)**\n We will begin by validating the happy flow scenarios for Transaction Management, covering approximately 65-70% of the functional requirements. This phase ensures that the fundamental workflows behave as expected under standard conditions.\n *Why this first?*\n - Establishes baseline functional correctness.\n - Allows early defect detection and reduces rework in later stages.\n - Enables smoother collaboration with development teams in case of issues.\n\n **Phase 2: Migrated Data Validation (Data Integrity Testing)**\n Once core functionality is validated, we will focus on migrated data testing at the database layer. Since data migration is a key event enabling this functionality, it is critical to verify that existing transactions are accurately present and available in the system post-migration.\n *Why now?*\n - Ensures historical transactions remain intact post-migration.\n - Prevents discrepancies before proceeding to further functional and integration tests.\n\n **Phase 3: Integration Testing (System Connectivity & Data Flow Testing)**\n Next, we will validate integration areas, ensuring that consumers of transactional data are in sync with the changing transactions. This will be performed through API testing, as integration is API-driven.\n *Why at this stage?*\n - By now, we have confidence in functional correctness and data integrity.\n - Ensures seamless interaction between the transaction system and external consumers.\n - Helps detect system-wide inconsistencies before moving to deeper validation.\n\n **Phase 4: Edge Case & Negative Scenario Testing (Resilience & Failure Handling)**\n At this stage, we will cover edge case scenarios, which are more prone to breaking the workflow. This includes boundary conditions, invalid inputs, concurrency issues, and error handling.\n *Why now?*\n - Functional and integration correctness is already established, allowing us to focus on resilience.\n - Helps assess the system's robustness in handling unexpected inputs and failures.\n\n **Phase 5: Exploratory Testing (Final Validations & Completeness Check)**\n Finally, we will perform exploratory testing to uncover issues that may not have been covered in structured test cases. This includes usability assessments, performance bottlenecks, and overlooked functional gaps.\n *Why at the end?*\n - Ensures real-world scenarios and human intuition-driven testing before deployment.\n - Helps identify potential last-minute gaps or overlooked issues.\n\n**This context is designed to make your test planning fast, consistent, and high quality.**";
|
|
7
|
+
//# sourceMappingURL=test-planner-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-planner-context.d.ts","sourceRoot":"","sources":["../../src/agents/test-planner-context.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,eAAO,MAAM,oBAAoB,iycAoR2D,CAAC"}
|