Tests: Add unit tests

This commit is contained in:
graciousgrey 2023-07-20 16:42:01 +02:00
parent 74f6954a90
commit e1364f288c
2 changed files with 51 additions and 0 deletions

View file

@ -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*")
}

View file

@ -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")
}