From 8e16a9c83281fdada25f0ccbcaa35bd00e6b3fea Mon Sep 17 00:00:00 2001 From: Theresa Gresch Date: Mon, 20 Jan 2020 18:34:15 +0100 Subject: [PATCH] Add test for index_options.go --- internal/photoprism/index_options_test.go | 30 +++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 internal/photoprism/index_options_test.go diff --git a/internal/photoprism/index_options_test.go b/internal/photoprism/index_options_test.go new file mode 100644 index 000000000..cedef6604 --- /dev/null +++ b/internal/photoprism/index_options_test.go @@ -0,0 +1,30 @@ +package photoprism + +import ( + "github.com/stretchr/testify/assert" + "testing" +) + +func TestIndexOptionsNone(t *testing.T) { + result := IndexOptionsNone() + assert.Equal(t, false, result.UpdateCamera) + assert.Equal(t, false, result.UpdateDate) + assert.Equal(t, false, result.UpdateColors) +} + +func TestIndexOptions_UpdateAny(t *testing.T) { + t.Run("true", func(t *testing.T) { + result := IndexOptionsAll() + assert.True(t, result.UpdateAny()) + }) + + t.Run("true", func(t *testing.T) { + result := IndexOptionsNone() + assert.False(t, result.UpdateAny()) + }) +} + +func TestIndexOptions_SkipUnchanged(t *testing.T) { + result := IndexOptionsNone() + assert.True(t, result.SkipUnchanged()) +}