status-go/signal/signals_test.go

21 lines
455 B
Go
Raw Normal View History

package signal
import (
"encoding/json"
"fmt"
"testing"
"github.com/stretchr/testify/require"
)
func TestNodeCrashEventJSONMarshalling(t *testing.T) {
errorMsg := "TestNodeCrashEventJSONMarshallingError"
expectedJSON := fmt.Sprintf(`{"error":"%s"}`, errorMsg)
nodeCrashEvent := &NodeCrashEvent{
2018-05-03 07:35:58 +00:00
Error: errorMsg,
}
marshalled, err := json.Marshal(nodeCrashEvent)
require.NoError(t, err)
require.Equal(t, expectedJSON, string(marshalled))
}