feat: fix issues
This commit is contained in:
@@ -64,3 +64,18 @@ func (s *PostsTestSuite) Test_Create() {
|
||||
So(post.UpdatedAt, ShouldNotBeZeroValue)
|
||||
})
|
||||
}
|
||||
|
||||
func (s *PostsTestSuite) Test_IncrView() {
|
||||
Convey("Test_IncrView", s.T(), func() {
|
||||
// database.Truncate(context.Background(), db, tblPosts.TableName())
|
||||
post, err := PostsModel().GetByID(context.Background(), 1)
|
||||
So(err, ShouldBeNil)
|
||||
oldViews := post.Views
|
||||
|
||||
So(post, ShouldNotBeNil)
|
||||
|
||||
err = post.IncrViewCount(context.Background())
|
||||
So(err, ShouldBeNil)
|
||||
So(post.Views, ShouldBeGreaterThan, oldViews)
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user