Files
opencloud/services/search/pkg/parity/query_path_test.go
T

38 lines
1.8 KiB
Go

package parity
import (
"github.com/opencloud-eu/opencloud/services/search/pkg/search"
)
func pathGroup() queryGroup {
return queryGroup{
name: "path",
fixtures: []search.Resource{
fixtureFolder("parent"),
fixtureDoc("child.jpg", withMime("image/jpeg"), withPath("./parent/child.jpg")),
fixtureFolder("docs-lower", withPath("./documents")),
fixtureFolder("docs-upper", withPath("./DOCUMENTS")),
fixtureFolder("docs-mixed", withPath("./Documents")),
},
cases: []queryCase{
{id: 1, query: `path:"./parent"`, want: []string{"parent", "child.jpg"}},
{id: 2, query: `path:"./parent/child.jpg"`, want: []string{"child.jpg"}},
{id: 3, query: `path:"./Parent"`},
{id: 4, query: `path:"*child*"`, want: []string{"child.jpg"}},
{id: 5, query: `path:"./documents"`, want: []string{"docs-lower"}},
{id: 6, query: `path:"./DOCUMENTS"`, want: []string{"docs-upper"}},
{id: 7, query: `path:"./Documents"`, want: []string{"docs-mixed"}},
{id: 8, query: `path:"./parent/"`, want: []string{"parent", "child.jpg"}},
{id: 9, query: `path:"/"`, want: []string{"parent", "child.jpg", "docs-lower", "docs-upper", "docs-mixed"}},
{id: 10, query: `path:""`, want: []string{"parent", "child.jpg", "docs-lower", "docs-upper", "docs-mixed"}},
{id: 11, query: `path:"/parent"`, want: []string{"parent", "child.jpg"}},
{id: 12, query: `path:"parent"`, want: []string{"parent", "child.jpg"}},
{id: 13, query: `path:"parent/*"`, want: []string{"child.jpg"}},
{id: 14, query: `path:"*/parent"`, want: []string{"parent", "child.jpg"}},
{id: 15, query: `path:"?/parent"`, want: []string{"parent", "child.jpg"}},
{id: 16, query: `path:"*/Documents"`, want: []string{"docs-mixed"}},
{id: 17, query: `path:"*/parent/"`, want: []string{"parent", "child.jpg"}},
},
}
}