diff --git a/backend/app/services/content_test.go b/backend/app/services/content_test.go index eccd99d..e34235b 100644 --- a/backend/app/services/content_test.go +++ b/backend/app/services/content_test.go @@ -265,6 +265,25 @@ func (s *ContentTestSuite) Test_Interact() { So(err, ShouldBeNil) So(len(favs), ShouldEqual, 0) }) + + Convey("should reject interactions for unpublished content", func() { + other := &models.User{Username: "user_act2", Phone: "13900000099"} + models.UserQuery.WithContext(ctx).Create(other) + + draft := &models.Content{ + TenantID: 1, + UserID: u.ID, + Title: "Draft Content", + Status: consts.ContentStatusDraft, + } + models.ContentQuery.WithContext(ctx).Create(draft) + + err := Content.AddLike(ctx, tenantID, other.ID, draft.ID) + So(err, ShouldNotBeNil) + + err = Content.AddFavorite(ctx, tenantID, other.ID, draft.ID) + So(err, ShouldNotBeNil) + }) }) }