Add goleak in unit tests

This commit is contained in:
Jamie Curnow
2023-11-08 09:57:15 +10:00
parent 689bcb0077
commit 6da020aab1
41 changed files with 371 additions and 8 deletions

View File

@ -4,15 +4,22 @@ import (
"testing"
"github.com/stretchr/testify/assert"
"go.uber.org/goleak"
)
func TestGet(t *testing.T) {
// goleak is used to detect goroutine leaks
defer goleak.VerifyNone(t, goleak.IgnoreAnyFunction("github.com/jc21/go-sse.(*Server).dispatch"))
s := Get()
assert.NotEqual(t, nil, s)
}
// This is just for code coverage more than anything
func TestEverything(t *testing.T) {
// goleak is used to detect goroutine leaks
defer goleak.VerifyNone(t)
Get()
SendMessage("test", "test", map[string]string{"user_id": "10"})
SendChange("hosts")