photoprism/pkg/clean/state_test.go
Michael Mayer 92e6c4fe1e Download: Add Disabled, Originals, MediaRaw & MediaSidecar Flags #2234
Extends DownloadSettings with 4 additional options:
- Name: File name pattern for downloaded files (existed)
- Disabled: Disables downloads
- Originals: Only download files stored in "originals" folder
- MediaRaw: Include RAW image files
- MediaSidecar: Include metadata sidecar files (JSON, XMP, YAML)
2022-04-15 09:42:07 +02:00

65 lines
1.3 KiB
Go

package clean
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestState(t *testing.T) {
t.Run("Berlin", func(t *testing.T) {
result := State("Berlin", "de")
assert.Equal(t, "Berlin", result)
})
t.Run("WA", func(t *testing.T) {
result := State("WA", "us")
assert.Equal(t, "Washington", result)
})
t.Run("QCUnknownCountry", func(t *testing.T) {
result := State("QC", "")
assert.Equal(t, "QC", result)
})
t.Run("QCCanada", func(t *testing.T) {
result := State("QC", "ca")
assert.Equal(t, "Quebec", result)
})
t.Run("QCUnitedStates", func(t *testing.T) {
result := State("QC", "us")
assert.Equal(t, "QC", result)
})
t.Run("Wa", func(t *testing.T) {
result := State("Wa", "us")
assert.Equal(t, "Wa", result)
})
t.Run("Washington", func(t *testing.T) {
result := State("Washington", "us")
assert.Equal(t, "Washington", result)
})
t.Run("Never mind Nirvana", func(t *testing.T) {
result := State("Never mind Nirvana.", "us")
assert.Equal(t, "Never mind Nirvana.", result)
})
t.Run("Empty", func(t *testing.T) {
result := State("", "us")
assert.Equal(t, "", result)
})
t.Run("Unknown", func(t *testing.T) {
result := State("zz", "us")
assert.Equal(t, "", result)
})
t.Run("Space", func(t *testing.T) {
result := State(" ", "us")
assert.Equal(t, "", result)
})
}