use testify asserts

This commit is contained in:
Jay
2025-10-23 13:20:55 -04:00
parent 417c97f168
commit e0c669351c
11 changed files with 142 additions and 294 deletions

View File

@@ -2,6 +2,7 @@ package roots
import (
"encoding/json"
"github.com/stretchr/testify/assert"
"testing"
)
@@ -16,8 +17,8 @@ func TestUnmarshalEventJSON(t *testing.T) {
func TestMarshalEventJSON(t *testing.T) {
eventJSONBytes, err := json.Marshal(testEvent)
expectOk(t, err)
expectEqualStrings(t, string(eventJSONBytes), testEventJSON)
assert.NoError(t, err)
assert.Equal(t, testEventJSON, string(eventJSONBytes))
}
func TestEventJSONRoundTrip(t *testing.T) {
@@ -40,8 +41,8 @@ func TestEventJSONRoundTrip(t *testing.T) {
t.Error("test event is invalid")
}
eventJSON, err := json.Marshal(event)
expectOk(t, err)
expectEqualStrings(t, string(eventJSON), expectedJSON)
assert.NoError(t, err)
assert.Equal(t, expectedJSON, string(eventJSON))
unmarshalledEvent := Event{}
json.Unmarshal(eventJSON, &unmarshalledEvent)