question_test.go 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. package service
  2. import (
  3. "context"
  4. "testing"
  5. "go-common/app/admin/main/answer/model"
  6. "github.com/smartystreets/goconvey/convey"
  7. )
  8. func TestServiceBatchUpdateState(t *testing.T) {
  9. convey.Convey("BatchUpdateState", t, func() {
  10. err := s.BatchUpdateState(context.TODO(), []int64{1, 2, 3}, 0, "")
  11. convey.So(err, convey.ShouldBeNil)
  12. })
  13. }
  14. func TestServiceTypes(t *testing.T) {
  15. convey.Convey("Types", t, func() {
  16. res, err := s.Types(context.TODO())
  17. convey.So(err, convey.ShouldBeNil)
  18. convey.So(res, convey.ShouldNotBeNil)
  19. })
  20. }
  21. func TestServiceQuestionAdd(t *testing.T) {
  22. q := &model.QuestionDB{ID: 1, Question: "test2333"}
  23. convey.Convey("QuestionAdd", t, func() {
  24. err := s.QuestionAdd(context.TODO(), q)
  25. convey.So(err, convey.ShouldBeNil)
  26. })
  27. convey.Convey("UpdateStatus", t, func() {
  28. err := s.UpdateStatus(context.TODO(), 1, 0, "")
  29. convey.So(err, convey.ShouldBeNil)
  30. })
  31. arg := &model.ArgQue{State: 1}
  32. convey.Convey("QuestionList", t, func() {
  33. res, err := s.QuestionList(context.TODO(), arg)
  34. convey.So(err, convey.ShouldBeNil)
  35. convey.So(res, convey.ShouldNotBeNil)
  36. })
  37. }
  38. func TestServiceloadtypes(t *testing.T) {
  39. convey.Convey("loadtypes", t, func() {
  40. t, err := s.loadtypes(context.TODO())
  41. convey.So(err, convey.ShouldBeNil)
  42. convey.So(t, convey.ShouldNotBeNil)
  43. })
  44. }