mirror of
https://github.com/navidrome/navidrome.git
synced 2025-06-09 11:52:35 +03:00
Add test to Event
This commit is contained in:
parent
7adacbac0d
commit
c7af3b8256
17
server/events/events_suite_test.go
Normal file
17
server/events/events_suite_test.go
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
package events
|
||||||
|
|
||||||
|
import (
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"github.com/deluan/navidrome/log"
|
||||||
|
"github.com/deluan/navidrome/tests"
|
||||||
|
. "github.com/onsi/ginkgo"
|
||||||
|
. "github.com/onsi/gomega"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestEvents(t *testing.T) {
|
||||||
|
tests.Init(t, false)
|
||||||
|
log.SetLevel(log.LevelCritical)
|
||||||
|
RegisterFailHandler(Fail)
|
||||||
|
RunSpecs(t, "Events Suite")
|
||||||
|
}
|
19
server/events/events_test.go
Normal file
19
server/events/events_test.go
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
package events
|
||||||
|
|
||||||
|
import (
|
||||||
|
. "github.com/onsi/ginkgo"
|
||||||
|
. "github.com/onsi/gomega"
|
||||||
|
)
|
||||||
|
|
||||||
|
var _ = Describe("Event", func() {
|
||||||
|
It("marshals Event to JSON", func() {
|
||||||
|
testEvent := TestEvent{Test: "some data"}
|
||||||
|
json := testEvent.Prepare(&testEvent)
|
||||||
|
Expect(json).To(Equal(`{"name":"testEvent","Test":"some data"}`))
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
type TestEvent struct {
|
||||||
|
baseEvent
|
||||||
|
Test string
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user