@@ -38,7 +38,7 @@ func TestUserAgentHeader(t *testing.T) {
3838 },
3939 }),
4040 )
41- client .Event .List (context .Background ())
41+ client .Event .ListStreaming (context .Background ())
4242 if userAgent != fmt .Sprintf ("Opencode/Go %s" , internal .PackageVersion ) {
4343 t .Errorf ("Expected User-Agent to be correct, but got: %#v" , userAgent )
4444 }
@@ -61,7 +61,11 @@ func TestRetryAfter(t *testing.T) {
6161 },
6262 }),
6363 )
64- _ , err := client .Event .List (context .Background ())
64+ stream := client .Event .ListStreaming (context .Background ())
65+ for stream .Next () {
66+ // ...
67+ }
68+ err := stream .Err ()
6569 if err == nil {
6670 t .Error ("Expected there to be a cancel error" )
6771 }
@@ -95,7 +99,11 @@ func TestDeleteRetryCountHeader(t *testing.T) {
9599 }),
96100 option .WithHeaderDel ("X-Stainless-Retry-Count" ),
97101 )
98- _ , err := client .Event .List (context .Background ())
102+ stream := client .Event .ListStreaming (context .Background ())
103+ for stream .Next () {
104+ // ...
105+ }
106+ err := stream .Err ()
99107 if err == nil {
100108 t .Error ("Expected there to be a cancel error" )
101109 }
@@ -124,7 +132,11 @@ func TestOverwriteRetryCountHeader(t *testing.T) {
124132 }),
125133 option .WithHeader ("X-Stainless-Retry-Count" , "42" ),
126134 )
127- _ , err := client .Event .List (context .Background ())
135+ stream := client .Event .ListStreaming (context .Background ())
136+ for stream .Next () {
137+ // ...
138+ }
139+ err := stream .Err ()
128140 if err == nil {
129141 t .Error ("Expected there to be a cancel error" )
130142 }
@@ -152,7 +164,11 @@ func TestRetryAfterMs(t *testing.T) {
152164 },
153165 }),
154166 )
155- _ , err := client .Event .List (context .Background ())
167+ stream := client .Event .ListStreaming (context .Background ())
168+ for stream .Next () {
169+ // ...
170+ }
171+ err := stream .Err ()
156172 if err == nil {
157173 t .Error ("Expected there to be a cancel error" )
158174 }
@@ -174,7 +190,11 @@ func TestContextCancel(t *testing.T) {
174190 )
175191 cancelCtx , cancel := context .WithCancel (context .Background ())
176192 cancel ()
177- _ , err := client .Event .List (cancelCtx )
193+ stream := client .Event .ListStreaming (cancelCtx )
194+ for stream .Next () {
195+ // ...
196+ }
197+ err := stream .Err ()
178198 if err == nil {
179199 t .Error ("Expected there to be a cancel error" )
180200 }
@@ -193,7 +213,11 @@ func TestContextCancelDelay(t *testing.T) {
193213 )
194214 cancelCtx , cancel := context .WithTimeout (context .Background (), 2 * time .Millisecond )
195215 defer cancel ()
196- _ , err := client .Event .List (cancelCtx )
216+ stream := client .Event .ListStreaming (cancelCtx )
217+ for stream .Next () {
218+ // ...
219+ }
220+ err := stream .Err ()
197221 if err == nil {
198222 t .Error ("expected there to be a cancel error" )
199223 }
@@ -218,7 +242,11 @@ func TestContextDeadline(t *testing.T) {
218242 },
219243 }),
220244 )
221- _ , err := client .Event .List (deadlineCtx )
245+ stream := client .Event .ListStreaming (deadlineCtx )
246+ for stream .Next () {
247+ // ...
248+ }
249+ err := stream .Err ()
222250 if err == nil {
223251 t .Error ("expected there to be a deadline error" )
224252 }
0 commit comments