mirror of
https://github.com/yibaiba/hideck.git
synced 2026-12-05 16:02:17 +00:00
27 lines
599 B
Go
27 lines
599 B
Go
package api
|
|
|
|
import (
|
|
"os"
|
|
"testing"
|
|
|
|
"gopkg.in/yaml.v3"
|
|
)
|
|
|
|
func TestOpenAPIVoHiveYAMLValid(t *testing.T) {
|
|
data, err := os.ReadFile("openapi.vohive.yaml")
|
|
if err != nil {
|
|
t.Fatalf("read openapi.vohive.yaml: %v", err)
|
|
}
|
|
var doc map[string]any
|
|
if err := yaml.Unmarshal(data, &doc); err != nil {
|
|
t.Fatalf("openapi.vohive.yaml is invalid YAML: %v", err)
|
|
}
|
|
if doc["openapi"] == "" {
|
|
t.Fatalf("openapi.vohive.yaml missing openapi version")
|
|
}
|
|
paths, ok := doc["paths"].(map[string]any)
|
|
if !ok || paths["/system/time"] == nil {
|
|
t.Fatal("openapi.vohive.yaml missing /system/time")
|
|
}
|
|
}
|