feat: 更新Go版本至1.23.0,并添加Swagger测试用例以验证生成的Swagger规范

This commit is contained in:
ryan
2026-03-11 14:29:43 +08:00
parent d6f51c244e
commit 6166192667
2 changed files with 22 additions and 1 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
module atsflare
// +heroku goVersion go1.18
go 1.18
go 1.23.0
require (
github.com/gin-contrib/cors v1.4.0
+21
View File
@@ -0,0 +1,21 @@
package router_test
import (
"os"
"strings"
"testing"
)
func TestGeneratedSwaggerSpecExists(t *testing.T) {
data, err := os.ReadFile("../docs/swagger.json")
if err != nil {
t.Fatalf("failed to read generated swagger spec: %v", err)
}
content := string(data)
if !strings.Contains(content, "\"title\": \"ATSFlare Server API\"") {
t.Fatal("expected swagger spec title to exist")
}
if !strings.Contains(content, "\"/api/proxy-routes/\"") {
t.Fatal("expected swagger spec to contain proxy route endpoint")
}
}