survey_test.go 738 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. package survey_test
  2. import (
  3. "fmt"
  4. "surveyService/cache"
  5. "surveyService/model"
  6. "testing"
  7. "github.com/joho/godotenv"
  8. "github.com/samber/lo"
  9. )
  10. // 创建问卷
  11. func TestCreate(t *testing.T) {
  12. // 加载dotEnv环境
  13. loadEnvErr := godotenv.Load("/Users/huang/Desktop/hys/surveyService/.env")
  14. if loadEnvErr != nil {
  15. fmt.Println("ENV环境加载Error")
  16. return
  17. }
  18. // 开始初始化数据库
  19. model.Construct(false)
  20. // 开始初始化缓存
  21. cache.InitRedis()
  22. var a = []string{"a", "b", "c"}
  23. var b = []string{"a", "b"}
  24. aa, ab := lo.Difference(a, b)
  25. fmt.Println(aa, ab)
  26. // survey.Create(&validators.Survey{
  27. // Name: "测试问卷",
  28. // Cover: "测试封面",
  29. // SurveyCode: "测试问卷编码",
  30. // })
  31. }