photoprism/pkg/fs/hash_test.go
Michael Mayer a4070cf55c Backend: Store and index original file names during import #184
Signed-off-by: Michael Mayer <michael@liquidbytes.net>
2020-02-01 20:52:28 +01:00

30 lines
661 B
Go

package fs
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestHash(t *testing.T) {
t.Run("existing image", func(t *testing.T) {
hash := Hash("testdata/test.jpg")
assert.Equal(t, "516cb1fefbfd9fa66f1db50b94503a480cee30db", hash)
})
t.Run("not existing image", func(t *testing.T) {
hash := Hash("testdata/xxx.jpg")
assert.Equal(t, "", hash)
})
}
func TestChecksum(t *testing.T) {
t.Run("existing image", func(t *testing.T) {
hash := Checksum("testdata/test.jpg")
assert.Equal(t, "5239d867", hash)
})
t.Run("not existing image", func(t *testing.T) {
hash := Checksum("testdata/xxx.jpg")
assert.Equal(t, "", hash)
})
}