feat: update posts

This commit is contained in:
Rogee
2025-05-23 21:21:12 +08:00
parent 92136a8093
commit f370887a71
5 changed files with 68 additions and 100 deletions

View File

@@ -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)
})
}