event_test.go 479 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-03T19:15:08.004+01:00","unique_id":"Z5ZWs1U9RoGQVugoz5SIrkmkj9T","payload":"Testing"}`
  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", expectedEventJSON, actual)
  17. }
  18. }