From a059ae8179bece40f345971e07febd4184a8029c Mon Sep 17 00:00:00 2001 From: Dominik Schmidt Date: Wed, 2 Dec 2026 16:47:28 +0100 Subject: [PATCH] test(webdav): drop the newTika helper again It only saved the preset argument, the other three still vary per call, and the calls changed anyway, so the diff got larger rather than smaller. --- services/webdav/pkg/preprocessor/tika_test.go | 13 ++++--------- services/webdav/pkg/thumbnail/tika_test.go | 19 +++++++------------ 2 files changed, 11 insertions(+), 21 deletions(-) diff --git a/services/webdav/pkg/preprocessor/tika_test.go b/services/webdav/pkg/preprocessor/tika_test.go index 897463aa6d..3b6820ec53 100644 --- a/services/webdav/pkg/preprocessor/tika_test.go +++ b/services/webdav/pkg/preprocessor/tika_test.go @@ -16,11 +16,6 @@ import ( "github.com/opencloud-eu/opencloud/services/webdav/pkg/thumbnail" ) -// newTika builds a Tika with the default preset, which these tests do not vary. -func newTika(url string, mimeTypes, additional []string) thumbnail.Tika { - return thumbnail.NewTika(url, "thumbnail", mimeTypes, additional) -} - // presetZip builds what /unpack/preset/thumbnail returns: the image the preset // selected, and whatever bookkeeping the package carries beside it. func presetZip(entries map[string][]byte) []byte { @@ -153,9 +148,9 @@ var _ = Describe("TikaThumbnail", func() { var _ = Describe("ForType with a Tika server", func() { const tikaURL = "http://tika:9998" - named := newTika(tikaURL, thumbnail.DefaultTikaTypes, nil) - everything := newTika(tikaURL, []string{"*"}, nil) - off := newTika("", thumbnail.DefaultTikaTypes, nil) + named := thumbnail.NewTika(tikaURL, "thumbnail", thumbnail.DefaultTikaTypes, nil) + everything := thumbnail.NewTika(tikaURL, "thumbnail", []string{"*"}, nil) + off := thumbnail.NewTika("", "thumbnail", thumbnail.DefaultTikaTypes, nil) tika := BeAssignableToTypeOf(TikaThumbnail{}) generator := BeNil() @@ -188,7 +183,7 @@ var _ = Describe("ForType with a Tika server", func() { } It("hands the mapped type to Tika", func() { - t := newTika(tikaURL, []string{"application/pdf", "image/x-nikon-nef:image/x-raw-nikon"}, nil) + t := thumbnail.NewTika(tikaURL, "thumbnail", []string{"application/pdf", "image/x-nikon-nef:image/x-raw-nikon"}, nil) Expect(ForType("image/x-nikon-nef", Options{Tika: t}).(TikaThumbnail).contentType).To(Equal("image/x-raw-nikon")) }) }) diff --git a/services/webdav/pkg/thumbnail/tika_test.go b/services/webdav/pkg/thumbnail/tika_test.go index d5d362fe2f..5de95dacc2 100644 --- a/services/webdav/pkg/thumbnail/tika_test.go +++ b/services/webdav/pkg/thumbnail/tika_test.go @@ -7,19 +7,14 @@ import ( "github.com/opencloud-eu/opencloud/services/webdav/pkg/thumbnail" ) -// newTika builds a Tika with the default preset, which these tests do not vary. -func newTika(url string, mimeTypes, additional []string) thumbnail.Tika { - return thumbnail.NewTika(url, "thumbnail", mimeTypes, additional) -} - var _ = Describe("Tika", func() { - none := newTika("", thumbnail.DefaultTikaTypes, nil) - all := newTika("http://tika:9998", []string{"*"}, nil) - nothing := newTika("http://tika:9998", nil, nil) - some := newTika("http://tika:9998", []string{" Application/PDF ", "audio/mpeg", "image/x-nikon-nef:image/x-raw-nikon"}, nil) - built := newTika("http://tika:9998", thumbnail.DefaultTikaTypes, nil) - extended := newTika("http://tika:9998", thumbnail.DefaultTikaTypes, []string{"application/zip", "image/heic"}) - extendedAll := newTika("http://tika:9998", thumbnail.DefaultTikaTypes, []string{"*"}) + none := thumbnail.NewTika("", "thumbnail", thumbnail.DefaultTikaTypes, nil) + all := thumbnail.NewTika("http://tika:9998", "thumbnail", []string{"*"}, nil) + nothing := thumbnail.NewTika("http://tika:9998", "thumbnail", nil, nil) + some := thumbnail.NewTika("http://tika:9998", "thumbnail", []string{" Application/PDF ", "audio/mpeg", "image/x-nikon-nef:image/x-raw-nikon"}, nil) + built := thumbnail.NewTika("http://tika:9998", "thumbnail", thumbnail.DefaultTikaTypes, nil) + extended := thumbnail.NewTika("http://tika:9998", "thumbnail", thumbnail.DefaultTikaTypes, []string{"application/zip", "image/heic"}) + extendedAll := thumbnail.NewTika("http://tika:9998", "thumbnail", thumbnail.DefaultTikaTypes, []string{"*"}) DescribeTable("Supports", func(tika thumbnail.Tika, mimeType string, want bool) {