Tests: Add unit tests

This commit is contained in:
graciousgrey 2023-07-20 17:58:53 +02:00
parent e1364f288c
commit 0817f1876d
2 changed files with 52 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 TestShowThumbSizesCommand(t *testing.T) {
var err error
ctx := config.CliTestContext()
output := capture.Output(func() {
err = ShowThumbSizesCommand.Run(ctx)
})
if err != nil {
t.Fatal(err)
}
assert.Contains(t, output, "fit_2048")
assert.Contains(t, output, "Mosaic View")
assert.Contains(t, output, "Color Detection")
}

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 TestShowVideoSizesCommand(t *testing.T) {
var err error
ctx := config.CliTestContext()
output := capture.Output(func() {
err = ShowVideoSizesCommand.Run(ctx)
})
if err != nil {
t.Fatal(err)
}
assert.Contains(t, output, "3840")
assert.Contains(t, output, "7680")
assert.Contains(t, output, "4K Ultra HD")
}