From 9b974e15537aecf5ae3c4f0498d289c166e92ef5 Mon Sep 17 00:00:00 2001 From: beer-psi Date: Sun, 2 Nov 2025 11:25:47 +0700 Subject: [PATCH] test: add tests for ASCII labels too --- core/share_test.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/core/share_test.go b/core/share_test.go index d85c4c582..ad5a986b1 100644 --- a/core/share_test.go +++ b/core/share_test.go @@ -39,6 +39,22 @@ var _ = Describe("Share", func() { Expect(entity.ID).To(Equal(id)) }) + It("does not truncate ASCII labels shorter than 30 characters", func() { + _ = ds.MediaFile(ctx).Put(&model.MediaFile{ID: "456", Title: "Example Media File"}) + entity := &model.Share{Description: "test", ResourceIDs: "456"} + _, err := repo.Save(entity) + Expect(err).ToNot(HaveOccurred()) + Expect(entity.Contents).To(Equal("Example Media File")) + }) + + It("truncates ASCII labels longer than 30 characters", func() { + _ = ds.MediaFile(ctx).Put(&model.MediaFile{ID: "789", Title: "Example Media File But The Title Is Really Long For Testing Purposes"}) + entity := &model.Share{Description: "test", ResourceIDs: "789"} + _, err := repo.Save(entity) + Expect(err).ToNot(HaveOccurred()) + Expect(entity.Contents).To(Equal("Example Media File But The...")) + }) + It("does not truncate CJK labels shorter than 30 runes", func() { _ = ds.MediaFile(ctx).Put(&model.MediaFile{ID: "456", Title: "青春コンプレックス"}) entity := &model.Share{Description: "test", ResourceIDs: "456"}