event_test.go 475 B

123456789101112131415161718192021
  1. package borealis
  2. import (
  3. "encoding/json"
  4. "testing"
  5. )
  6. const (
  7. expectedEventJSON = `{"type":"1","sequential_id":2,"timestamp":"2009-01-03T20:15:08.004+02:00","unique_id":"Z5ZWs1U9RoGQVugoz5SIrkmkj9T","payload":{}}`
  8. )
  9. func TestEncodeEventJSON(t *testing.T) {
  10. output, err := json.Marshal(expectedEvent)
  11. if err != nil {
  12. t.Error(err)
  13. }
  14. actual := string(output)
  15. if actual != expectedEventJSON {
  16. t.Errorf("expected %v, but got %v", expectedRawEventJSON, actual)
  17. }
  18. }