photoprism/internal/entity/lens_test.go
Michael Mayer 95cc4ec43f Backend: Code clean-up
Signed-off-by: Michael Mayer <michael@liquidbytes.net>
2020-04-26 17:15:17 +02:00

29 lines
752 B
Go

package entity
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestNewLens(t *testing.T) {
t.Run("name F500-99 make Canon", func(t *testing.T) {
lens := NewLens("F500-99", "Canon")
assert.Equal(t, "F500-99", lens.LensModel)
assert.Equal(t, "Canon", lens.LensMake)
assert.Equal(t, "f500-99", lens.LensSlug)
})
t.Run("name Unknown make Unknown", func(t *testing.T) {
lens := NewLens("", "")
assert.Equal(t, "Unknown", lens.LensModel)
assert.Equal(t, "", lens.LensMake)
assert.Equal(t, UnknownLens.LensSlug, lens.LensSlug)
assert.Equal(t, &UnknownLens, lens)
})
}
func TestLens_TableName(t *testing.T) {
lens := NewLens("F500-99", "Canon")
tableName := lens.TableName()
assert.Equal(t, "lenses", tableName)
}