labour_test.go 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. package service
  2. import (
  3. "context"
  4. "testing"
  5. "go-common/app/interface/main/credit/model"
  6. . "github.com/smartystreets/goconvey/convey"
  7. )
  8. // TestServiceAddQs .
  9. func TestServiceAddQs(t *testing.T) {
  10. Convey("TestServiceAddQs", t, func() {
  11. qs := &model.LabourQs{}
  12. qs.Question = "test"
  13. qs.AvID = 666
  14. qs.Source = 1
  15. err := s.AddQs(context.TODO(), qs)
  16. So(err, ShouldBeNil)
  17. })
  18. }
  19. // TestServiceSetQs
  20. func TestServiceSetQs(t *testing.T) {
  21. Convey("TestServiceSetQs", t, func() {
  22. var (
  23. c = context.TODO()
  24. id int64 = 3
  25. ans int64 = 2
  26. status int64 = 2
  27. )
  28. err := s.SetQs(c, id, ans, status)
  29. So(err, ShouldBeNil)
  30. })
  31. }
  32. // TestCommit .
  33. func TestCommit(t *testing.T) {
  34. Convey("TestCommit", t, func() {
  35. ans := &model.LabourAns{
  36. ID: []int64{},
  37. Answer: []int64{},
  38. }
  39. for i := 0; i < 40; i++ {
  40. ans.ID = append(ans.ID, int64(i))
  41. ans.Answer = append(ans.Answer, 1)
  42. }
  43. res, err := s.CommitQs(context.TODO(), 88895349, "aa", "1", "11", ans)
  44. So(err, ShouldBeNil)
  45. So(res, ShouldNotBeNil)
  46. })
  47. }