From 65223911f82ca25c8ee5e9fc2b5a3591348aec9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aleksa=20Siri=C5=A1ki?= <31509435+aleksasiriski@users.noreply.github.com> Date: Sat, 22 Jun 2024 01:37:21 +0200 Subject: [PATCH] fix(search): tests and validate overlooked --- src/search/params.go | 4 +++- src/search/result/shorten_test.go | 12 ------------ 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/src/search/params.go b/src/search/params.go index 4bc02d8d..610fd0d5 100644 --- a/src/search/params.go +++ b/src/search/params.go @@ -18,7 +18,9 @@ func validateSuggestParams(query string, locale options.Locale) error { } func validateSearchParams(query string, opts options.Options) error { - validateSuggestParams(query, opts.Locale) + if err := validateSuggestParams(query, opts.Locale); err != nil { + return err + } if opts.Pages.Start < 0 { return fmt.Errorf("pages start can't be negative") diff --git a/src/search/result/shorten_test.go b/src/search/result/shorten_test.go index 5a8c625a..91898e41 100644 --- a/src/search/result/shorten_test.go +++ b/src/search/result/shorten_test.go @@ -179,18 +179,6 @@ func TestShorten3(t *testing.T) { {"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.", "Lor"}, } - // Create test results. - var results = make([]General, 0, len(tests)) - for _, test := range tests { - v := General{ - generalJSON: generalJSON{ - Title: test.orig, - Description: test.orig, - }, - } - results = append(results, v) - } - // Check if the results are shortened as expected. for _, test := range tests { short := shortString(test.orig, 3)