You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
1.3 KiB
51 lines
1.3 KiB
package service |
|
|
|
import ( |
|
"context" |
|
"testing" |
|
|
|
"go-common/app/admin/main/answer/model" |
|
|
|
"github.com/smartystreets/goconvey/convey" |
|
) |
|
|
|
func TestServiceBatchUpdateState(t *testing.T) { |
|
convey.Convey("BatchUpdateState", t, func() { |
|
err := s.BatchUpdateState(context.TODO(), []int64{1, 2, 3}, 0, "") |
|
convey.So(err, convey.ShouldBeNil) |
|
}) |
|
} |
|
|
|
func TestServiceTypes(t *testing.T) { |
|
convey.Convey("Types", t, func() { |
|
res, err := s.Types(context.TODO()) |
|
convey.So(err, convey.ShouldBeNil) |
|
convey.So(res, convey.ShouldNotBeNil) |
|
}) |
|
} |
|
|
|
func TestServiceQuestionAdd(t *testing.T) { |
|
q := &model.QuestionDB{ID: 1, Question: "test2333"} |
|
convey.Convey("QuestionAdd", t, func() { |
|
err := s.QuestionAdd(context.TODO(), q) |
|
convey.So(err, convey.ShouldBeNil) |
|
}) |
|
convey.Convey("UpdateStatus", t, func() { |
|
err := s.UpdateStatus(context.TODO(), 1, 0, "") |
|
convey.So(err, convey.ShouldBeNil) |
|
}) |
|
arg := &model.ArgQue{State: 1} |
|
convey.Convey("QuestionList", t, func() { |
|
res, err := s.QuestionList(context.TODO(), arg) |
|
convey.So(err, convey.ShouldBeNil) |
|
convey.So(res, convey.ShouldNotBeNil) |
|
}) |
|
} |
|
|
|
func TestServiceloadtypes(t *testing.T) { |
|
convey.Convey("loadtypes", t, func() { |
|
t, err := s.loadtypes(context.TODO()) |
|
convey.So(err, convey.ShouldBeNil) |
|
convey.So(t, convey.ShouldNotBeNil) |
|
}) |
|
}
|
|
|