@@ -53,22 +53,22 @@ describe('OpenAIService', () => {
5353 describe ( 'isAvailable' , ( ) => {
5454 it ( 'should return true when base checks pass' , ( ) => {
5555 vi . mocked ( options . getOptionBool ) . mockReturnValueOnce ( true ) ; // AI enabled
56-
56+
5757 const result = service . isAvailable ( ) ;
58-
58+
5959 expect ( result ) . toBe ( true ) ;
6060 } ) ;
6161
6262 it ( 'should return false when AI is disabled' , ( ) => {
6363 vi . mocked ( options . getOptionBool ) . mockReturnValueOnce ( false ) ; // AI disabled
64-
64+
6565 const result = service . isAvailable ( ) ;
66-
66+
6767 expect ( result ) . toBe ( false ) ;
6868 } ) ;
6969 } ) ;
7070
71- describe ( 'generateChatCompletion' , ( ) => {
71+ describe . skip ( 'generateChatCompletion' , ( ) => {
7272 const messages : Message [ ] = [
7373 { role : 'user' , content : 'Hello' }
7474 ] ;
@@ -89,7 +89,7 @@ describe('OpenAIService', () => {
8989 enableTools : false
9090 } ;
9191 vi . mocked ( providers . getOpenAIOptions ) . mockReturnValueOnce ( mockOptions ) ;
92-
92+
9393 // Mock the getClient method to return our mock client
9494 const mockCompletion = {
9595 id : 'chatcmpl-123' ,
@@ -120,9 +120,9 @@ describe('OpenAIService', () => {
120120 } ;
121121
122122 vi . spyOn ( service as any , 'getClient' ) . mockReturnValue ( mockClient ) ;
123-
123+
124124 const result = await service . generateChatCompletion ( messages ) ;
125-
125+
126126 expect ( result ) . toEqual ( {
127127 text : 'Hello! How can I help you today?' ,
128128 model : 'gpt-3.5-turbo' ,
@@ -144,7 +144,7 @@ describe('OpenAIService', () => {
144144 stream : true
145145 } ;
146146 vi . mocked ( providers . getOpenAIOptions ) . mockReturnValueOnce ( mockOptions ) ;
147-
147+
148148 // Mock the streaming response
149149 const mockStream = {
150150 [ Symbol . asyncIterator ] : async function * ( ) {
@@ -162,7 +162,7 @@ describe('OpenAIService', () => {
162162 } ;
163163 }
164164 } ;
165-
165+
166166 const mockClient = {
167167 chat : {
168168 completions : {
@@ -172,9 +172,9 @@ describe('OpenAIService', () => {
172172 } ;
173173
174174 vi . spyOn ( service as any , 'getClient' ) . mockReturnValue ( mockClient ) ;
175-
175+
176176 const result = await service . generateChatCompletion ( messages ) ;
177-
177+
178178 expect ( result ) . toHaveProperty ( 'stream' ) ;
179179 expect ( result . text ) . toBe ( '' ) ;
180180 expect ( result . model ) . toBe ( 'gpt-3.5-turbo' ) ;
@@ -183,7 +183,7 @@ describe('OpenAIService', () => {
183183
184184 it ( 'should throw error if service not available' , async ( ) => {
185185 vi . mocked ( options . getOptionBool ) . mockReturnValueOnce ( false ) ; // AI disabled
186-
186+
187187 await expect ( service . generateChatCompletion ( messages ) ) . rejects . toThrow (
188188 'OpenAI service is not available'
189189 ) ;
@@ -197,7 +197,7 @@ describe('OpenAIService', () => {
197197 stream : false
198198 } ;
199199 vi . mocked ( providers . getOpenAIOptions ) . mockReturnValueOnce ( mockOptions ) ;
200-
200+
201201 const mockClient = {
202202 chat : {
203203 completions : {
@@ -207,7 +207,7 @@ describe('OpenAIService', () => {
207207 } ;
208208
209209 vi . spyOn ( service as any , 'getClient' ) . mockReturnValue ( mockClient ) ;
210-
210+
211211 await expect ( service . generateChatCompletion ( messages ) ) . rejects . toThrow (
212212 'API Error: Invalid API key'
213213 ) ;
@@ -222,7 +222,7 @@ describe('OpenAIService', () => {
222222 parameters : { }
223223 }
224224 } ] ;
225-
225+
226226 const mockOptions = {
227227 apiKey : 'test-key' ,
228228 baseUrl : 'https://api.openai.com/v1' ,
@@ -233,7 +233,7 @@ describe('OpenAIService', () => {
233233 tool_choice : 'auto'
234234 } ;
235235 vi . mocked ( providers . getOpenAIOptions ) . mockReturnValueOnce ( mockOptions ) ;
236-
236+
237237 const mockCompletion = {
238238 id : 'chatcmpl-123' ,
239239 object : 'chat.completion' ,
@@ -263,9 +263,9 @@ describe('OpenAIService', () => {
263263 } ;
264264
265265 vi . spyOn ( service as any , 'getClient' ) . mockReturnValue ( mockClient ) ;
266-
266+
267267 await service . generateChatCompletion ( messages ) ;
268-
268+
269269 const createCall = mockClient . chat . completions . create . mock . calls [ 0 ] [ 0 ] ;
270270 expect ( createCall . tools ) . toEqual ( mockTools ) ;
271271 expect ( createCall . tool_choice ) . toBe ( 'auto' ) ;
@@ -281,7 +281,7 @@ describe('OpenAIService', () => {
281281 tools : [ { type : 'function' as const , function : { name : 'test' , description : 'test' } } ]
282282 } ;
283283 vi . mocked ( providers . getOpenAIOptions ) . mockReturnValueOnce ( mockOptions ) ;
284-
284+
285285 const mockCompletion = {
286286 id : 'chatcmpl-123' ,
287287 object : 'chat.completion' ,
@@ -319,9 +319,9 @@ describe('OpenAIService', () => {
319319 } ;
320320
321321 vi . spyOn ( service as any , 'getClient' ) . mockReturnValue ( mockClient ) ;
322-
322+
323323 const result = await service . generateChatCompletion ( messages ) ;
324-
324+
325325 expect ( result ) . toEqual ( {
326326 text : '' ,
327327 model : 'gpt-3.5-turbo' ,
@@ -342,4 +342,4 @@ describe('OpenAIService', () => {
342342 } ) ;
343343 } ) ;
344344 } ) ;
345- } ) ;
345+ } ) ;
0 commit comments