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.
 
 
 

72 lines
1.8 KiB

package service
import (
"context"
"testing"
"go-common/app/job/main/figure/model"
repmol "go-common/app/job/main/reply/model/reply"
. "github.com/smartystreets/goconvey/convey"
)
var (
testReplyMid int64 = 120
testRefReplyMid int64 = 121
)
// go test -test.v -test.run TestPutReplyInfo
func TestPutReplyInfo(t *testing.T) {
Convey("TestPutReplyInfo put add reply", t, WithService(func(s *Service) {
So(s.PutReplyInfo(context.TODO(), &model.ReplyEvent{
Mid: testReplyMid,
Action: model.EventAdd,
Reply: &repmol.Reply{
Mid: testRefReplyMid,
},
}), ShouldBeNil)
}))
Convey("TestPutReplyInfo put add reply", t, WithService(func(s *Service) {
So(s.PutReplyInfo(context.TODO(), &model.ReplyEvent{
Mid: testReplyMid,
Action: model.EventLike,
Reply: &repmol.Reply{
Mid: testRefReplyMid,
},
}), ShouldBeNil)
So(s.PutReplyInfo(context.TODO(), &model.ReplyEvent{
Mid: testReplyMid,
Action: model.EventLike,
Reply: &repmol.Reply{
Mid: testRefReplyMid,
},
}), ShouldBeNil)
}))
Convey("TestPutReplyInfo put add reply", t, WithService(func(s *Service) {
So(s.PutReplyInfo(context.TODO(), &model.ReplyEvent{
Mid: testReplyMid,
Action: model.EventLikeCancel,
Reply: &repmol.Reply{
Mid: testRefReplyMid,
},
}), ShouldBeNil)
}))
Convey("TestPutReplyInfo put hate", t, WithService(func(s *Service) {
So(s.PutReplyInfo(context.TODO(), &model.ReplyEvent{
Mid: testReplyMid,
Action: model.EventHate,
Reply: &repmol.Reply{
Mid: testRefReplyMid,
},
}), ShouldBeNil)
}))
Convey("TestPutReplyInfo put hate cancel", t, WithService(func(s *Service) {
So(s.PutReplyInfo(context.TODO(), &model.ReplyEvent{
Mid: testReplyMid,
Action: model.EventHateCancel,
Reply: &repmol.Reply{
Mid: testRefReplyMid,
},
}), ShouldBeNil)
}))
}