photoprism/internal/entity/file_fixtures_test.go

36 lines
999 B
Go
Raw Normal View History

2021-08-26 17:24:48 +02:00
package entity
import (
"testing"
2021-08-28 13:55:37 +02:00
"github.com/stretchr/testify/assert"
2021-08-26 17:24:48 +02:00
)
func TestFileMap_Get(t *testing.T) {
t.Run("get existing file", func(t *testing.T) {
r := FileFixtures.Get("exampleFileName.jpg")
assert.Equal(t, "fs6sg6bw45bnlqdw", r.FileUID)
2021-08-26 17:24:48 +02:00
assert.Equal(t, "2790/07/27900704_070228_D6D51B6C.jpg", r.FileName)
assert.IsType(t, File{}, r)
})
t.Run("get not existing file", func(t *testing.T) {
r := FileFixtures.Get("TestName")
assert.Equal(t, "TestName", r.FileName)
assert.IsType(t, File{}, r)
})
}
func TestFileMap_Pointer(t *testing.T) {
t.Run("get existing file", func(t *testing.T) {
r := FileFixtures.Pointer("exampleFileName.jpg")
assert.Equal(t, "fs6sg6bw45bnlqdw", r.FileUID)
2021-08-26 17:24:48 +02:00
assert.Equal(t, "2790/07/27900704_070228_D6D51B6C.jpg", r.FileName)
assert.IsType(t, &File{}, r)
})
t.Run("get not existing file", func(t *testing.T) {
r := FileFixtures.Pointer("TestName")
assert.Equal(t, "TestName", r.FileName)
assert.IsType(t, &File{}, r)
})
}