2020-01-12 13:00:56 +00:00
|
|
|
package fs
|
2019-05-03 16:57:28 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestHash(t *testing.T) {
|
2019-07-17 11:22:55 +00:00
|
|
|
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)
|
|
|
|
})
|
2019-05-03 16:57:28 +00:00
|
|
|
}
|
2020-02-01 19:52:28 +00:00
|
|
|
|
|
|
|
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)
|
|
|
|
})
|
|
|
|
}
|