mirror of
https://github.com/photoprism/photoprism.git
synced 2025-12-12 08:44:04 +01:00
Tests: Add unit tests
This commit is contained in:
25
internal/commands/version_test.go
Normal file
25
internal/commands/version_test.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package commands
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/photoprism/photoprism/pkg/capture"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestVersionCommand(t *testing.T) {
|
||||
var err error
|
||||
|
||||
// Create test context with flags and arguments.
|
||||
ctx := NewTestContext([]string{""})
|
||||
|
||||
// Run command with test context.
|
||||
output := capture.Output(func() {
|
||||
err = VersionCommand.Run(ctx)
|
||||
})
|
||||
|
||||
// Check command output for plausibility.
|
||||
// t.Logf(output)
|
||||
assert.NoError(t, err)
|
||||
assert.Contains(t, output, "test")
|
||||
}
|
||||
Reference in New Issue
Block a user