photoprism/internal/event/format_test.go
Michael Mayer dce754182e Logs: Refactor message formatting in event package
Signed-off-by: Michael Mayer <michael@photoprism.app>
2025-03-26 12:58:51 +01:00

22 lines
520 B
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package event
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/photoprism/photoprism/pkg/clean"
)
func TestFormat(t *testing.T) {
assert.Equal(t, "", Format(nil))
assert.Equal(t, "user", Format([]string{"user"}))
assert.Equal(t, "user michael not found", Format([]string{"user", "michael", "not found"}))
result := Format([]string{"user", "%s not found"}, clean.LogQuote("michael"))
expected := "user 'michael' not found"
assert.Equal(t, expected, result)
t.Log(result)
}