Part data model (#950)

This commit is contained in:
Dax
2025-07-13 17:22:11 -04:00
committed by GitHub
parent 736396fc70
commit 90d6c4ab41
27 changed files with 1447 additions and 965 deletions

View File

@@ -38,7 +38,7 @@ func TestUserAgentHeader(t *testing.T) {
},
}),
)
client.Event.List(context.Background())
client.Event.ListStreaming(context.Background())
if userAgent != fmt.Sprintf("Opencode/Go %s", internal.PackageVersion) {
t.Errorf("Expected User-Agent to be correct, but got: %#v", userAgent)
}
@@ -61,7 +61,11 @@ func TestRetryAfter(t *testing.T) {
},
}),
)
_, err := client.Event.List(context.Background())
stream := client.Event.ListStreaming(context.Background())
for stream.Next() {
// ...
}
err := stream.Err()
if err == nil {
t.Error("Expected there to be a cancel error")
}
@@ -95,7 +99,11 @@ func TestDeleteRetryCountHeader(t *testing.T) {
}),
option.WithHeaderDel("X-Stainless-Retry-Count"),
)
_, err := client.Event.List(context.Background())
stream := client.Event.ListStreaming(context.Background())
for stream.Next() {
// ...
}
err := stream.Err()
if err == nil {
t.Error("Expected there to be a cancel error")
}
@@ -124,7 +132,11 @@ func TestOverwriteRetryCountHeader(t *testing.T) {
}),
option.WithHeader("X-Stainless-Retry-Count", "42"),
)
_, err := client.Event.List(context.Background())
stream := client.Event.ListStreaming(context.Background())
for stream.Next() {
// ...
}
err := stream.Err()
if err == nil {
t.Error("Expected there to be a cancel error")
}
@@ -152,7 +164,11 @@ func TestRetryAfterMs(t *testing.T) {
},
}),
)
_, err := client.Event.List(context.Background())
stream := client.Event.ListStreaming(context.Background())
for stream.Next() {
// ...
}
err := stream.Err()
if err == nil {
t.Error("Expected there to be a cancel error")
}
@@ -174,7 +190,11 @@ func TestContextCancel(t *testing.T) {
)
cancelCtx, cancel := context.WithCancel(context.Background())
cancel()
_, err := client.Event.List(cancelCtx)
stream := client.Event.ListStreaming(cancelCtx)
for stream.Next() {
// ...
}
err := stream.Err()
if err == nil {
t.Error("Expected there to be a cancel error")
}
@@ -193,7 +213,11 @@ func TestContextCancelDelay(t *testing.T) {
)
cancelCtx, cancel := context.WithTimeout(context.Background(), 2*time.Millisecond)
defer cancel()
_, err := client.Event.List(cancelCtx)
stream := client.Event.ListStreaming(cancelCtx)
for stream.Next() {
// ...
}
err := stream.Err()
if err == nil {
t.Error("expected there to be a cancel error")
}
@@ -218,7 +242,11 @@ func TestContextDeadline(t *testing.T) {
},
}),
)
_, err := client.Event.List(deadlineCtx)
stream := client.Event.ListStreaming(deadlineCtx)
for stream.Next() {
// ...
}
err := stream.Err()
if err == nil {
t.Error("expected there to be a deadline error")
}