add tests for webhook events (#2180)

* add tests for webhook events

* atomic.Uint32 is not in Go 1.18
This commit is contained in:
Matthew Donoughe
2022-10-10 01:55:54 -04:00
committed by GitHub
parent 155d671df0
commit 10055664bb
10 changed files with 596 additions and 12 deletions

View File

@@ -0,0 +1,26 @@
package webhooks
import (
"testing"
"time"
"github.com/owncast/owncast/core/chat/events"
"github.com/owncast/owncast/core/data"
"github.com/owncast/owncast/models"
)
func TestSendStreamStatusEvent(t *testing.T) {
data.SetServerName("my server")
data.SetServerSummary("my server where I stream")
data.SetStreamTitle("my stream")
checkPayload(t, models.StreamStarted, func() {
sendStreamStatusEvent(events.StreamStarted, "id", time.Unix(72, 6).UTC())
}, `{
"id": "id",
"name": "my server",
"streamTitle": "my stream",
"summary": "my server where I stream",
"timestamp": "1970-01-01T00:01:12.000000006Z"
}`)
}