1+ export const fixTestScriptInstructions = `
2+ const expect = (actual: any) => ({
3+ to: {
4+ equal: (expected: any) => {
5+
6+ },
7+ notEqual: (expected: any) => {
8+ },
9+ exist: () => {
10+
11+ },
12+ notExist: () => {
13+
14+ },
15+ be: {
16+ a: (type: string) => {
17+ },
18+ true: () => {
19+ },
20+ false: () => {
21+
22+
23+ },
24+ within: (min: number, max: number) => {
25+
26+ },
27+ lessThan: (expected: number) => {
28+ },
29+ greaterThan: (expected: number) => {
30+
31+ },
32+ empty: () => {
33+
34+ },
35+ notEmpty: () => {
36+
37+ },
38+ },
39+ contain: (expected: any) => {
40+
41+ },
42+ notContain: (expected: any) => {
43+
44+ },
45+ beInList: (list: any[]) => {
46+
47+ },
48+ notBeInList: (list: any[]) => {
49+
50+ },
51+ have: {
52+ all: {
53+ keys: (...keys: string[]) => {
54+
55+ },
56+ },
57+ },
58+ },
59+ });
60+
61+ const sp = {
62+ response: {
63+ statusCode: number ,
64+ body: {
65+ text: () => {
66+ try {
67+ return string;
68+ } catch {
69+ return {};
70+ }
71+ },
72+ json: () => {
73+ try {
74+ return JSON.parse(string);
75+ } catch {
76+ return {};
77+ }
78+ },
79+ },
80+ headers: object,
81+ size: number,
82+ time: number,
83+ },
84+ test: (name: string, fn: Function) => {
85+ try {
86+ fn();
87+ } catch (err: any) {
88+ }
89+ },
90+ xmlToJSON: (xml: string) => {
91+ const json = {};
92+ // Convert XML to JSON logic here
93+ return json;
94+ },
95+ expect,
96+ };
97+
98+ - Fix testcases using above syntax,
99+ - Ensure all test cases are valid syntactically,
100+ - Dont use any other syntax or return any other text outside of the test cases.
101+ - Dont use any markdown or code snippet
102+ - Do not wrap the output in markdown, code fences, or labels (e.g., "javascript", "Here are...", etc.).
103+ - The model should return only raw JavaScript test cases in the correct syntax.
104+ - Unnecessary text like "Here are the corrected test cases:" are not required, its breaking the js syntax.
105+ - Dont give any introduction or ending phrase just give only the testcase.
106+ - Example format: '
107+ sp.test("userId is a number", function () {
108+ sp.expect(jsonBody.userId).to.be.a("number");
109+ });
110+ '
111+ ` ;
0 commit comments