Initial commit of Descrybe v2 without local scratch artifacts.
Drop one-shot tmp/axe scripts and agent i18n scratch so the Gitea tree is deployable.
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
package httpapi
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestV1OpenAPIFeedsLegacyContract(t *testing.T) {
|
||||
t.Parallel()
|
||||
body := string(v1OpenAPIYAML)
|
||||
for _, needle := range []string{
|
||||
"Legacy public contract — { data: Feed[], meta: { page, limit, total } }",
|
||||
"required: [name, item_path]",
|
||||
"jobId:",
|
||||
"FeedSyncResponse",
|
||||
"PresentFeed",
|
||||
"item_path:",
|
||||
"is_active:",
|
||||
"product_count:",
|
||||
"last_synced:",
|
||||
"HTTP 200 { data: { jobId } }",
|
||||
} {
|
||||
if !strings.Contains(body, needle) {
|
||||
t.Fatalf("openapi feeds section missing %q", needle)
|
||||
}
|
||||
}
|
||||
syncIdx := strings.Index(body, "/feeds/{id}/sync:")
|
||||
if syncIdx < 0 {
|
||||
t.Fatal("missing sync path")
|
||||
}
|
||||
chunk := body[syncIdx:]
|
||||
end := strings.Index(chunk, "\n /feeds/{id}/mappings:")
|
||||
if end > 0 {
|
||||
chunk = chunk[:end]
|
||||
}
|
||||
if !strings.Contains(chunk, `"200":`) {
|
||||
t.Fatalf("sync path missing 200 response")
|
||||
}
|
||||
if strings.Contains(chunk, `"202":`) {
|
||||
t.Fatalf("public sync path should not advertise 202")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user