From e1364f288cba40b251b00c38859d8b776c24823c Mon Sep 17 00:00:00 2001 From: graciousgrey Date: Thu, 20 Jul 2023 16:42:01 +0200 Subject: [PATCH] Tests: Add unit tests --- internal/commands/show_config_options_test.go | 26 +++++++++++++++++++ internal/commands/show_config_yaml_test.go | 25 ++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 internal/commands/show_config_options_test.go create mode 100644 internal/commands/show_config_yaml_test.go diff --git a/internal/commands/show_config_options_test.go b/internal/commands/show_config_options_test.go new file mode 100644 index 000000000..4387bd78a --- /dev/null +++ b/internal/commands/show_config_options_test.go @@ -0,0 +1,26 @@ +package commands + +import ( + "github.com/photoprism/photoprism/internal/config" + "github.com/photoprism/photoprism/pkg/capture" + "github.com/stretchr/testify/assert" + "testing" +) + +func TestShowConfigOptionsCommand(t *testing.T) { + var err error + + ctx := config.CliTestContext() + + output := capture.Output(func() { + err = ShowConfigOptionsCommand.Run(ctx) + }) + + if err != nil { + t.Fatal(err) + } + + assert.Contains(t, output, "PHOTOPRISM_IMPORT_PATH") + assert.Contains(t, output, "--sidecar-path") + assert.Contains(t, output, "sidecar `PATH` *optional*") +} diff --git a/internal/commands/show_config_yaml_test.go b/internal/commands/show_config_yaml_test.go new file mode 100644 index 000000000..14d97819a --- /dev/null +++ b/internal/commands/show_config_yaml_test.go @@ -0,0 +1,25 @@ +package commands + +import ( + "github.com/photoprism/photoprism/internal/config" + "github.com/photoprism/photoprism/pkg/capture" + "github.com/stretchr/testify/assert" + "testing" +) + +func TestShowConfigYamlCommand(t *testing.T) { + var err error + + ctx := config.CliTestContext() + + output := capture.Output(func() { + err = ShowConfigYamlCommand.Run(ctx) + }) + + if err != nil { + t.Fatal(err) + } + + assert.Contains(t, output, "ImportPath") + assert.Contains(t, output, "--sidecar-path") +}