2023-07-28 01:01:54 -04:00
|
|
|
package serverevents
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
2023-11-07 18:57:15 -05:00
|
|
|
"go.uber.org/goleak"
|
2023-07-28 01:01:54 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestGet(t *testing.T) {
|
2023-11-07 18:57:15 -05:00
|
|
|
// goleak is used to detect goroutine leaks
|
|
|
|
defer goleak.VerifyNone(t, goleak.IgnoreAnyFunction("github.com/jc21/go-sse.(*Server).dispatch"))
|
|
|
|
|
2023-07-28 01:01:54 -04:00
|
|
|
s := Get()
|
|
|
|
assert.NotEqual(t, nil, s)
|
|
|
|
}
|
|
|
|
|
|
|
|
// This is just for code coverage more than anything
|
|
|
|
func TestEverything(t *testing.T) {
|
2023-11-07 18:57:15 -05:00
|
|
|
// goleak is used to detect goroutine leaks
|
|
|
|
defer goleak.VerifyNone(t)
|
|
|
|
|
2023-07-28 01:01:54 -04:00
|
|
|
Get()
|
|
|
|
SendMessage("test", "test", map[string]string{"user_id": "10"})
|
|
|
|
SendChange("hosts")
|
|
|
|
Shutdown()
|
|
|
|
}
|