Tests: Add unit tests

This commit is contained in:
graciousgrey 2023-08-30 16:30:06 +02:00
parent ba612f6619
commit afe2190797
4 changed files with 54 additions and 0 deletions

View file

@ -0,0 +1,13 @@
package config
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestOptions_Report(t *testing.T) {
m := Options{}
r, _ := m.Report()
assert.GreaterOrEqual(t, len(r), 1)
}

View file

@ -0,0 +1,13 @@
package config
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestConfig_Report(t *testing.T) {
m := NewConfig(CliTestContext())
r, _ := m.Report()
assert.GreaterOrEqual(t, len(r), 1)
}

View file

@ -0,0 +1,12 @@
package colors
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestProfile_Equal(t *testing.T) {
assert.True(t, ProfileDisplayP3.Equal("Display P3"))
assert.False(t, ProfileDisplayP3.Equal(""))
}

16
pkg/media/report_test.go Normal file
View file

@ -0,0 +1,16 @@
package media
import (
"testing"
"github.com/photoprism/photoprism/pkg/fs"
"github.com/stretchr/testify/assert"
)
func TestReport(t *testing.T) {
m := fs.Extensions.Types(true)
r, _ := Report(m, true, true, true)
assert.GreaterOrEqual(t, len(r), 1)
r2, _ := Report(m, false, true, true)
assert.GreaterOrEqual(t, len(r2), 1)
}