mirror of
https://github.com/wshobson/agents.git
synced 2026-03-18 17:47:16 +00:00
style: format all files with prettier
This commit is contained in:
@@ -147,18 +147,21 @@ class JestTestGenerator {
|
||||
{
|
||||
name: `${functionName} returns expected result with valid input`,
|
||||
execution: `const result = ${functionName}(${this.generateMockParams(params)})`,
|
||||
assertions: ['expect(result).toBeDefined()', 'expect(result).not.toBeNull()']
|
||||
assertions: [
|
||||
"expect(result).toBeDefined()",
|
||||
"expect(result).not.toBeNull()",
|
||||
],
|
||||
},
|
||||
{
|
||||
name: `${functionName} handles null input gracefully`,
|
||||
execution: `const result = ${functionName}(null)`,
|
||||
assertions: ['expect(result).toBeDefined()']
|
||||
assertions: ["expect(result).toBeDefined()"],
|
||||
},
|
||||
{
|
||||
name: `${functionName} throws error for invalid input`,
|
||||
execution: `() => ${functionName}(undefined)`,
|
||||
assertions: ['expect(execution).toThrow()']
|
||||
}
|
||||
assertions: ["expect(execution).toThrow()"],
|
||||
},
|
||||
];
|
||||
|
||||
return this.formatJestSuite(functionName, tests);
|
||||
@@ -179,12 +182,14 @@ class JestTestGenerator {
|
||||
output += ` });\n\n`;
|
||||
}
|
||||
|
||||
output += '});\n';
|
||||
output += "});\n";
|
||||
return output;
|
||||
}
|
||||
|
||||
generateMockParams(params: string[]): string {
|
||||
return params.map(p => `mock${p.charAt(0).toUpperCase() + p.slice(1)}`).join(', ');
|
||||
return params
|
||||
.map((p) => `mock${p.charAt(0).toUpperCase() + p.slice(1)}`)
|
||||
.join(", ");
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user