Skip to content

Commit 7ccc36c

Browse files
committed
Added prompt for /rcc-testcases command
1 parent 2a4e950 commit 7ccc36c

File tree

1 file changed

+43
-1
lines changed

1 file changed

+43
-1
lines changed

ai-assistant/src/core/prompt.factory.ts

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,47 @@ export namespace PromptFactory {
179179
return prompt;
180180
}
181181

182+
export function makeTestcasesPrompt(
183+
targetEntity: string,
184+
codebase: string,
185+
testingFramework: string
186+
): Prompt {
187+
const prompt = new Prompt();
188+
189+
prompt.pushSystem(`
190+
You are an expert in understanding typescript and javascript.
191+
192+
INPUT: target entity, other code entities the target entity uses, testing framework.
193+
194+
TASK: Based on the context (other code entities) provided, write various test cases for the target entity in the specified testing framwork.
195+
196+
EXPECTED OUTPUT: 100% code coverage testcases in markdown format.
197+
198+
RULES:
199+
- STRICTLY, do not make anything other than the answer to the user's query.
200+
- DO NOT REPEAT THE TRANSLATION MULTIPLE TIMES.
201+
- Do not provide any kind of diagram or visualization in the output.
202+
- The output MUST BE IN ONLY AND ONLY STRING.
203+
`);
204+
prompt.pushUser(`
205+
Hey, can you write testcases for the following entity. I have provided you with other entities as well on which my target entity depends. Here you go:
206+
207+
<TESTING_FRAMEWORK_START>
208+
${testingFramework}
209+
<TESTING_FRAMEWORK_END>
210+
211+
<TARGET_ENTITY_START>
212+
${targetEntity}
213+
<TARGET_ENTITY_END>
214+
215+
<OTHER_ENTITIES_START>
216+
${codebase}
217+
<OTHER_ENTITIES_END>
218+
`);
219+
220+
return prompt;
221+
}
222+
182223
export function makeTranslatePrompt(
183224
codebase: string,
184225
targetEntity: string,
@@ -208,7 +249,8 @@ export namespace PromptFactory {
208249
${codebase}
209250
<CODEBASE_END>
210251
211-
<TARGET_ENTITY_START>${targetEntity}
252+
<TARGET_ENTITY_START>
253+
${targetEntity}
212254
<TARGET_ENTITY_END>
213255
`);
214256

0 commit comments

Comments
 (0)