@@ -132,7 +132,7 @@ func TestRunSuccess(t *testing.T) {
132132 defer server .Close ()
133133
134134 client := NewClient ("test-key" , server .URL , 0 , 0 , 0 , 0 )
135- result , err := client .Run ("wavespeed-ai/z-image/turbo" , map [string ]any {"prompt" : "test" }, 0 , 0 .01, false , 0 )
135+ result , err := client .Run ("wavespeed-ai/z-image/turbo" , map [string ]any {"prompt" : "test" }, WithPollInterval ( 0 .01) )
136136 if err != nil {
137137 t .Fatalf ("run error: %v" , err )
138138 }
@@ -162,7 +162,7 @@ func TestRunFailure(t *testing.T) {
162162 defer server .Close ()
163163
164164 client := NewClient ("test-key" , server .URL , 0 , 0 , 0 , 0 )
165- _ , err := client .Run ("wavespeed-ai/z-image/turbo" , map [string ]any {"prompt" : "test" }, 0 , 0 .01, false , 0 )
165+ _ , err := client .Run ("wavespeed-ai/z-image/turbo" , map [string ]any {"prompt" : "test" }, WithPollInterval ( 0 .01) )
166166 if err == nil {
167167 t .Fatal ("expected error for failed prediction" )
168168 }
@@ -206,7 +206,7 @@ func TestUploadFilePath(t *testing.T) {
206206 defer os .Remove (tmpFile )
207207
208208 client := NewClient ("test-key" , server .URL , 0 , 0 , 0 , 0 )
209- url , err := client .Upload (tmpFile , 0 )
209+ url , err := client .Upload (tmpFile )
210210 if err != nil {
211211 t .Fatalf ("upload error: %v" , err )
212212 }
@@ -217,7 +217,7 @@ func TestUploadFilePath(t *testing.T) {
217217
218218func TestUploadFileNotFound (t * testing.T ) {
219219 client := NewClient ("test-key" , "" , 0 , 0 , 0 , 0 )
220- _ , err := client .Upload ("/nonexistent/path/to/file.png" , 0 )
220+ _ , err := client .Upload ("/nonexistent/path/to/file.png" )
221221 if err == nil {
222222 t .Fatal ("expected error for non-existent file" )
223223 }
@@ -229,7 +229,7 @@ func TestUploadFileNotFound(t *testing.T) {
229229func TestUploadRaisesWithoutAPIKey (t * testing.T ) {
230230 client := NewClient ("" , "" , 0 , 0 , 0 , 0 )
231231 client .apiKey = ""
232- _ , err := client .Upload ("/some/file.png" , 0 )
232+ _ , err := client .Upload ("/some/file.png" )
233233 if err == nil {
234234 t .Fatal ("expected error when no API key provided" )
235235 }
@@ -254,7 +254,7 @@ func TestUploadHTTPError(t *testing.T) {
254254 defer os .Remove (tmpFile )
255255
256256 client := NewClient ("test-key" , server .URL , 0 , 0 , 0 , 0 )
257- _ , err := client .Upload (tmpFile , 0 )
257+ _ , err := client .Upload (tmpFile )
258258 if err == nil {
259259 t .Fatal ("expected error for HTTP 500" )
260260 }
@@ -279,7 +279,7 @@ func TestUploadAPIError(t *testing.T) {
279279 defer os .Remove (tmpFile )
280280
281281 client := NewClient ("test-key" , server .URL , 0 , 0 , 0 , 0 )
282- _ , err := client .Upload (tmpFile , 0 )
282+ _ , err := client .Upload (tmpFile )
283283 if err == nil {
284284 t .Fatal ("expected error for API error response" )
285285 }
@@ -299,7 +299,7 @@ func TestRunSyncModeFailure(t *testing.T) {
299299 defer server .Close ()
300300
301301 client := NewClient ("test-key" , server .URL , 0 , 0 , 0 , 0 )
302- _ , err := client .Run ("wavespeed-ai/z-image/turbo" , map [string ]any {"prompt" : "test" }, 0 , 0 , true , 0 )
302+ _ , err := client .Run ("wavespeed-ai/z-image/turbo" , map [string ]any {"prompt" : "test" }, WithSyncMode ( true ) )
303303 if err == nil {
304304 t .Fatal ("expected error for non-completed status in sync mode" )
305305 }
@@ -329,7 +329,7 @@ func TestRunTimeout(t *testing.T) {
329329 defer server .Close ()
330330
331331 client := NewClient ("test-key" , server .URL , 0 , 0 , 0 , 0 )
332- _ , err := client .Run ("wavespeed-ai/z-image/turbo" , map [string ]any {"prompt" : "test" }, 0.1 , 0.01 , false , 0 )
332+ _ , err := client .Run ("wavespeed-ai/z-image/turbo" , map [string ]any {"prompt" : "test" }, WithTimeout ( 0.1 ), WithPollInterval ( 0.01 ) )
333333 if err == nil {
334334 t .Fatal ("expected timeout error" )
335335 }
@@ -366,7 +366,7 @@ func TestRunUsesDefaultClient(t *testing.T) {
366366 defaultClient = nil
367367
368368 // Use module-level Run function
369- result , err := Run ("wavespeed-ai/z-image/turbo" , map [string ]any {"prompt" : "test" }, 0 , 0 .01, false , 0 )
369+ result , err := Run ("wavespeed-ai/z-image/turbo" , map [string ]any {"prompt" : "test" }, WithPollInterval ( 0 .01) )
370370 if err != nil {
371371 // This will fail because we can't override the base URL for the default client
372372 // But we're testing that it attempts to use the default client
@@ -395,7 +395,6 @@ func TestRunRealAPI(t *testing.T) {
395395 output , err := Run (
396396 "wavespeed-ai/z-image/turbo" ,
397397 map [string ]any {"prompt" : "A simple red circle on white background" },
398- 0 , 0 , false , 0 ,
399398 )
400399 if err != nil {
401400 t .Fatalf ("run error: %v" , err )
@@ -450,7 +449,7 @@ func TestUploadRealAPI(t *testing.T) {
450449 }
451450 defer os .Remove (tmpFile )
452451
453- url , err := Upload (tmpFile , 0 )
452+ url , err := Upload (tmpFile )
454453 if err != nil {
455454 t .Fatalf ("upload error: %v" , err )
456455 }
@@ -476,7 +475,7 @@ func TestRunAllRetriesFailed(t *testing.T) {
476475 defer server .Close ()
477476
478477 client := NewClient ("test-key" , server .URL , 0 , 2 , 0 , 0.01 ) // maxRetries=2
479- _ , err := client .Run ("wavespeed-ai/z-image/turbo" , map [string ]any {"prompt" : "test" }, 0 , 0 .01, false , 2 )
478+ _ , err := client .Run ("wavespeed-ai/z-image/turbo" , map [string ]any {"prompt" : "test" }, WithPollInterval ( 0 .01), WithMaxRetries ( 2 ) )
480479
481480 if err == nil {
482481 t .Fatal ("expected error after all retries failed" )
0 commit comments