feat: 完善环境规则、会诊治理、知识审核与效果评估
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
package handler
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func TestConsultationStrPtr(t *testing.T) {
|
||||
if consultationStrPtr("") != nil {
|
||||
t.Error("空字符串应为 nil")
|
||||
}
|
||||
if got := consultationStrPtr("原因"); got == nil || *got != "原因" {
|
||||
t.Errorf("非空字符串应返回指针: %v", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCanReviewKnowledge(t *testing.T) {
|
||||
gin.SetMode(gin.TestMode)
|
||||
rec := httptest.NewRecorder()
|
||||
c, _ := gin.CreateTestContext(rec)
|
||||
c.Request = httptest.NewRequest(http.MethodGet, "/", nil)
|
||||
if canReviewKnowledge(c) {
|
||||
t.Error("nil context 不应通过")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user