| 14 | }; |
| 15 | |
| 16 | export class TestAi implements TestAiEngine { |
| 17 | mockType: TestMockType; |
| 18 | |
| 19 | // those are not used in the test engine |
| 20 | config: any; |
| 21 | client: any; |
| 22 | // --- |
| 23 | |
| 24 | constructor(mockType: TestMockType) { |
| 25 | this.mockType = mockType; |
| 26 | } |
| 27 | |
| 28 | async generateCommitMessage( |
| 29 | _messages: Array<OpenAI.Chat.Completions.ChatCompletionMessageParam> |
| 30 | ): Promise<string | undefined> { |
| 31 | switch (this.mockType) { |
| 32 | case 'commit-message': |
| 33 | return 'fix(testAi.ts): test commit message'; |
| 34 | case 'prompt-module-commitlint-config': |
| 35 | return ( |
| 36 | `{\n` + |
| 37 | ` "localLanguage": "english",\n` + |
| 38 | ` "commitFix": "fix(server): Change 'port' variable to uppercase 'PORT'",\n` + |
| 39 | ` "commitFeat": "feat(server): Allow server to listen on a port specified through environment variable",\n` + |
| 40 | ` "commitDescription": "Change 'port' variable to uppercase 'PORT'. Allow server to listen on a port specified through environment variable."\n` + |
| 41 | `}` |
| 42 | ); |
| 43 | default: |
| 44 | throw Error('unsupported test mock type'); |
| 45 | } |
| 46 | } |
| 47 | } |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…