26 lines
634 B
Go
26 lines
634 B
Go
package openapi
|
|
|
|
import "testing"
|
|
|
|
func TestSpec(t *testing.T) {
|
|
spec := Spec()
|
|
if spec["openapi"] != "3.0.3" {
|
|
t.Fatalf("openapi version = %v", spec["openapi"])
|
|
}
|
|
paths, ok := spec["paths"].(map[string]any)
|
|
if !ok || len(paths) < 12 {
|
|
t.Fatalf("expected at least 12 paths, got %d", len(paths))
|
|
}
|
|
if _, ok := paths["/api/v1/status"]; !ok {
|
|
t.Fatal("missing /api/v1/status")
|
|
}
|
|
components, ok := spec["components"].(map[string]any)
|
|
if !ok {
|
|
t.Fatal("missing components")
|
|
}
|
|
schemas, ok := components["schemas"].(map[string]any)
|
|
if !ok || len(schemas) < 10 {
|
|
t.Fatalf("expected schemas, got %d", len(schemas))
|
|
}
|
|
}
|