@@ -19,7 +19,6 @@ import { Operation } from 'genkit';
1919import { GenerateRequest } from 'genkit/model' ;
2020import { afterEach , beforeEach , describe , it } from 'node:test' ;
2121import * as sinon from 'sinon' ;
22-
2322import { getGenkitClientHeader } from '../../src/common/utils.js' ;
2423import { getGoogleAIUrl } from '../../src/googleai/client.js' ;
2524import { VeoOperation , VeoPredictRequest } from '../../src/googleai/types.js' ;
@@ -236,8 +235,8 @@ describe('Google AI Veo', () => {
236235 } ;
237236 mockFetchResponse ( mockOp ) ;
238237
239- const modelAction = captureModelRunner ( { apiKey : defaultApiKey } ) ;
240- const result = await modelAction . start ( request ) ;
238+ const { start } = captureModelRunner ( { apiKey : defaultApiKey } ) ;
239+ const result = await start ( request ) ;
241240
242241 sinon . assert . calledOnce ( fetchStub ) ;
243242 const fetchArgs = fetchStub . lastCall . args ;
@@ -276,12 +275,12 @@ describe('Google AI Veo', () => {
276275 const apiVersion = 'v1test' ;
277276 const baseUrl = 'https://test.example.com' ;
278277
279- const modelAction = captureModelRunner ( {
278+ const { start } = captureModelRunner ( {
280279 apiKey : defaultApiKey ,
281280 apiVersion,
282281 baseUrl,
283282 } ) ;
284- await modelAction . start ( request ) ;
283+ await start ( request ) ;
285284
286285 sinon . assert . calledOnce ( fetchStub ) ;
287286 const fetchArgs = fetchStub . lastCall . args ;
@@ -298,8 +297,8 @@ describe('Google AI Veo', () => {
298297 envStub . value ( { GOOGLE_API_KEY : envKey } ) ;
299298 mockFetchResponse ( { name : 'operations/start789' , done : false } ) ;
300299
301- const modelAction = captureModelRunner ( { apiKey : undefined } ) ;
302- await modelAction . start ( request ) ;
300+ const { start } = captureModelRunner ( { apiKey : undefined } ) ;
301+ await start ( request ) ;
303302
304303 sinon . assert . calledOnce ( fetchStub ) ;
305304 const fetchArgs = fetchStub . lastCall . args ;
@@ -310,9 +309,9 @@ describe('Google AI Veo', () => {
310309 const errorBody = { error : { message : 'Invalid argument' , code : 400 } } ;
311310 mockFetchResponse ( errorBody , 400 ) ;
312311
313- const modelAction = captureModelRunner ( { apiKey : defaultApiKey } ) ;
312+ const { start } = captureModelRunner ( { apiKey : defaultApiKey } ) ;
314313 await assert . rejects (
315- modelAction . start ( request ) ,
314+ start ( request ) ,
316315 / E r r o r f e t c h i n g f r o m .* m o d e l s \/ v e o - t e s t - m o d e l : p r e d i c t L o n g R u n n i n g .* I n v a l i d a r g u m e n t /
317316 ) ;
318317 } ) ;
@@ -334,8 +333,8 @@ describe('Google AI Veo', () => {
334333 } ;
335334 mockFetchResponse ( mockResponse ) ;
336335
337- const modelAction = captureModelRunner ( { apiKey : defaultApiKey } ) ;
338- const result = await modelAction . check ( pendingOp ) ;
336+ const { check } = captureModelRunner ( { apiKey : defaultApiKey } ) ;
337+ const result = await check ( pendingOp ) ;
339338
340339 sinon . assert . calledOnce ( fetchStub ) ;
341340 const fetchArgs = fetchStub . lastCall . args ;
@@ -365,12 +364,12 @@ describe('Google AI Veo', () => {
365364 const apiVersion = 'v1test' ;
366365 const baseUrl = 'https://test.example.com' ;
367366
368- const modelAction = captureModelRunner ( {
367+ const { check } = captureModelRunner ( {
369368 apiKey : defaultApiKey ,
370369 apiVersion,
371370 baseUrl,
372371 } ) ;
373- await modelAction . check ( pendingOp ) ;
372+ await check ( pendingOp ) ;
374373
375374 sinon . assert . calledOnce ( fetchStub ) ;
376375 const fetchArgs = fetchStub . lastCall . args ;
@@ -385,9 +384,9 @@ describe('Google AI Veo', () => {
385384 const errorBody = { error : { message : 'Not found' , code : 404 } } ;
386385 mockFetchResponse ( errorBody , 404 ) ;
387386
388- const modelAction = captureModelRunner ( { apiKey : defaultApiKey } ) ;
387+ const { check } = captureModelRunner ( { apiKey : defaultApiKey } ) ;
389388 await assert . rejects (
390- modelAction . check ( pendingOp ) ,
389+ check ( pendingOp ) ,
391390 / E r r o r f e t c h i n g f r o m .* o p e r a t i o n s \/ c h e c k 1 2 3 .* N o t f o u n d /
392391 ) ;
393392 } ) ;
0 commit comments