mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-09-29 05:56:38 +08:00
feat: 更新Go版本至1.23.0,并添加Swagger测试用例以验证生成的Swagger规范
This commit is contained in:
+1
-1
@@ -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
|
||||
|
||||
@@ -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")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user