2022-03-30 20:36:25 +02:00
|
|
|
package search
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestSelectString(t *testing.T) {
|
|
|
|
t.Run("PhotoWildcard", func(t *testing.T) {
|
|
|
|
// SelectCols returns a string containing the
|
|
|
|
// comma separated column names.
|
|
|
|
result := SelectString(Photo{}, []string{"*"})
|
2022-04-13 22:17:59 +02:00
|
|
|
assert.GreaterOrEqual(t, len(result), 1636)
|
2022-03-30 20:36:25 +02:00
|
|
|
})
|
|
|
|
t.Run("PhotoGeoResult", func(t *testing.T) {
|
|
|
|
// SelectCols returns a string containing
|
|
|
|
// the selected column names.
|
|
|
|
result := SelectString(Photo{}, SelectCols(GeoResult{}, []string{"*"}))
|
|
|
|
|
|
|
|
t.Logf("PhotoGeoResult: %d cols, %#v", len(result), result)
|
2022-04-13 22:17:59 +02:00
|
|
|
assert.GreaterOrEqual(t, len(result), 245)
|
2022-03-30 20:36:25 +02:00
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestSelectCols(t *testing.T) {
|
|
|
|
t.Run("PhotoWildcard", func(t *testing.T) {
|
|
|
|
// SelectCols returns a string containing
|
|
|
|
// the selected column names.
|
|
|
|
result := SelectCols(Photo{}, []string{"*"})
|
2022-04-13 22:17:59 +02:00
|
|
|
assert.GreaterOrEqual(t, len(result), 83)
|
2022-03-30 20:36:25 +02:00
|
|
|
})
|
|
|
|
t.Run("PhotoGeoResult", func(t *testing.T) {
|
|
|
|
// SelectCols returns a string containing
|
|
|
|
// the selected column names.
|
|
|
|
result := SelectCols(Photo{}, SelectCols(GeoResult{}, []string{"*"}))
|
|
|
|
|
|
|
|
t.Logf("PhotoGeoResult: %d cols, %#v", len(result), result)
|
2022-04-13 22:17:59 +02:00
|
|
|
assert.GreaterOrEqual(t, len(result), 13)
|
2022-03-30 20:36:25 +02:00
|
|
|
})
|
|
|
|
}
|