mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-11-27 10:34:42 -05:00
* chore: bump reva to 2.52.2 * Merge pull request #42 from opencloud-eu/fix-web-theme-merge fix(web): merge copies of the theme sources so themeDefaults is never mutated * Merge pull request #43 from opencloud-eu/fix-search-trailing-not fix(search): handle missing operands in the bleve compiler * Merge pull request #44 from opencloud-eu/fix-search-highlight-escaping fix(search): escape file content in OpenSearch highlights --------- Co-authored-by: Ralf Haferkamp <r.haferkamp@opencloud.eu> Co-authored-by: Florian Schade <f.schade@icloud.com>
44 lines
1.0 KiB
Go
44 lines
1.0 KiB
Go
package content_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
. "github.com/stretchr/testify/assert"
|
|
|
|
"github.com/opencloud-eu/opencloud/services/search/pkg/content"
|
|
)
|
|
|
|
func TestCleanContent(t *testing.T) {
|
|
tests := []struct {
|
|
given string
|
|
expect string
|
|
}{
|
|
{
|
|
given: "find can keeper should keeper will",
|
|
expect: "keeper keeper",
|
|
},
|
|
{
|
|
given: "user1 shares the file to Mary",
|
|
expect: "user1 shares file mary",
|
|
},
|
|
{
|
|
given: "content contains https://localhost/remote.php/dav/files/admin/Photos/San%20Francisco.jpg and stop word",
|
|
expect: "content contains https://localhost/remote.php/dav/files/admin/photos/san%20francisco.jpg stop word",
|
|
},
|
|
{
|
|
given: "needle <img src=x> needle",
|
|
expect: "needle <img src=x> needle",
|
|
},
|
|
{
|
|
given: "List<String> names from Alice <alice@example.com>",
|
|
expect: "list<string> names alice <alice@example.com>",
|
|
},
|
|
}
|
|
|
|
for _, tc := range tests {
|
|
t.Run(tc.given, func(t *testing.T) {
|
|
Equal(t, tc.expect, content.CleanString(tc.given, "en"))
|
|
})
|
|
}
|
|
}
|