1234567891011121314151617181920212223242526272829303132333435363738 |
- package survey_test
- import (
- "fmt"
- "surveyService/cache"
- "surveyService/model"
- "testing"
- "github.com/joho/godotenv"
- "github.com/samber/lo"
- )
- // 创建问卷
- func TestCreate(t *testing.T) {
- // 加载dotEnv环境
- loadEnvErr := godotenv.Load("/Users/huang/Desktop/hys/surveyService/.env")
- if loadEnvErr != nil {
- fmt.Println("ENV环境加载Error")
- return
- }
- // 开始初始化数据库
- model.Construct(false)
- // 开始初始化缓存
- cache.InitRedis()
- var a = []string{"a", "b", "c"}
- var b = []string{"a", "b"}
- aa, ab := lo.Difference(a, b)
- fmt.Println(aa, ab)
- // survey.Create(&validators.Survey{
- // Name: "测试问卷",
- // Cover: "测试封面",
- // SurveyCode: "测试问卷编码",
- // })
- }
|