diff options
| author | Jeff Halter <868228+jhalter@users.noreply.github.com> | 2021-08-15 10:39:43 -0700 |
|---|---|---|
| committer | Jeff Halter <868228+jhalter@users.noreply.github.com> | 2021-08-15 10:39:43 -0700 |
| commit | 00d1ef67636df59460bd4e060f6da4b0c9bcb24c (patch) | |
| tree | 23c0b75535ab187bd690e03e286b64395efeba2f /hotline/server_blackbox_test.go | |
| parent | c5d9af5aa4d9fb20316be45ab1b775bcf61bcad5 (diff) | |
Tests and minor fixes
Diffstat (limited to 'hotline/server_blackbox_test.go')
| -rw-r--r-- | hotline/server_blackbox_test.go | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/hotline/server_blackbox_test.go b/hotline/server_blackbox_test.go index 09687ad..64d56ab 100644 --- a/hotline/server_blackbox_test.go +++ b/hotline/server_blackbox_test.go @@ -4,11 +4,12 @@ import ( "bytes" "context" "fmt" + "github.com/davecgh/go-spew/spew" + "github.com/stretchr/testify/assert" "go.uber.org/zap" "go.uber.org/zap/zapcore" "net" "os" - "reflect" "testing" ) @@ -309,22 +310,21 @@ func TestNewUser(t *testing.T) { } } -// equal is a utility function used only in tests that determines if transactions are equal enough -func (t Transaction) equal(otherT Transaction) bool { - t.ID = []byte{0, 0, 0, 0} - otherT.ID = []byte{0, 0, 0, 0} - - t.TotalSize = []byte{0, 0, 0, 0} - otherT.TotalSize = []byte{0, 0, 0, 0} +func tranAssertEqual(t *testing.T, tran1, tran2 []Transaction) bool { + var newT1 []Transaction + var newT2 []Transaction + for _, trans := range tran1{ + trans.ID = []byte{0,0,0,0} + newT1 = append(newT1, trans) + } - t.DataSize = []byte{0, 0, 0, 0} - otherT.DataSize = []byte{0, 0, 0, 0} + for _, trans := range tran2{ + trans.ID = []byte{0,0,0,0} + newT2 = append(newT2, trans) - t.ParamCount = []byte{0, 0} - otherT.ParamCount = []byte{0, 0} + } - //spew.Dump(t) - //spew.Dump(otherT) + spew.Dump(newT1, newT2) - return reflect.DeepEqual(t, otherT) -} + return assert.Equal(t, newT1, newT2) +}
\ No newline at end of file |