feat: update posts
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
||||
|
||||
"quyun/app/service/testx"
|
||||
"quyun/database"
|
||||
"quyun/database/fields"
|
||||
"quyun/database/table"
|
||||
|
||||
. "github.com/smartystreets/goconvey/convey"
|
||||
@@ -41,3 +42,26 @@ func (s *PostsTestSuite) Test_Demo() {
|
||||
database.Truncate(context.Background(), db, table.Posts.TableName())
|
||||
})
|
||||
}
|
||||
|
||||
// Test_Create
|
||||
func (s *PostsTestSuite) Test_Create() {
|
||||
Convey("Test_Create", s.T(), func() {
|
||||
// database.Truncate(context.Background(), db, table.Posts.TableName())
|
||||
|
||||
post := &Posts{
|
||||
Title: "Test Post",
|
||||
Description: "This is a test post",
|
||||
Content: "Post content goes here",
|
||||
Price: 100,
|
||||
Discount: 10,
|
||||
Status: fields.PostStatusDraft,
|
||||
}
|
||||
|
||||
err := post.Create(context.Background())
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
So(post.ID, ShouldNotBeZeroValue)
|
||||
So(post.CreatedAt, ShouldNotBeZeroValue)
|
||||
So(post.UpdatedAt, ShouldNotBeZeroValue)
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user