photoprism/internal/event/buffer_test.go
Michael Mayer 2de1e338bd Logs: Prevent feedback loops by omitting repeated messages #2335
This also prevents debug and trace messages to be sent to the frontend.
2022-05-20 11:31:39 +02:00

19 lines
372 B
Go

package event
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestBuffer(t *testing.T) {
b := Buffer{}
assert.Equal(t, "", b.Get())
assert.Equal(t, nil, b.Set("foo123 !!!"))
assert.Equal(t, "foo123 !!!", b.Get())
assert.Equal(t, nil, b.Set("BAR"))
assert.Equal(t, "BAR", b.Get())
assert.Equal(t, nil, b.Set(""))
assert.Equal(t, "", b.Get())
}