Skip to content

Commit

Permalink
fix(search): tests and validate overlooked
Browse files Browse the repository at this point in the history
  • Loading branch information
aleksasiriski committed Jun 21, 2024
1 parent eef938c commit 6522391
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
4 changes: 3 additions & 1 deletion src/search/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
12 changes: 0 additions & 12 deletions src/search/result/shorten_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 6522391

Please sign in to comment.