]> git.r.bdr.sh - rbdr/mobius/blobdiff - hotline/transaction_handlers_test.go
Convert bespoke methods to io.Reader/io.Writer interfaces
[rbdr/mobius] / hotline / transaction_handlers_test.go
index 89ee9fce9b39d04303e0d1fb0c4b9af66b55aed5..94854f2f68d89ca825d23c8eb17ad07ed2f920c5 100644 (file)
@@ -5,6 +5,7 @@ import (
        "fmt"
        "github.com/stretchr/testify/assert"
        "github.com/stretchr/testify/mock"
+       "io"
        "io/fs"
        "math/rand"
        "os"
@@ -768,7 +769,6 @@ func TestHandleGetFileInfo(t *testing.T) {
                                                NewField(FieldFileName, []byte("testfile.txt")),
                                                NewField(FieldFileTypeString, []byte("Text File")),
                                                NewField(FieldFileCreatorString, []byte("ttxt")),
-                                               NewField(FieldFileComment, []byte{}),
                                                NewField(FieldFileType, []byte("TEXT")),
                                                NewField(FieldFileCreateDate, make([]byte, 8)),
                                                NewField(FieldFileModifyDate, make([]byte, 8)),
@@ -791,8 +791,8 @@ func TestHandleGetFileInfo(t *testing.T) {
 
                        // Clear the fileWrapper timestamp fields to work around problems running the tests in multiple timezones
                        // TODO: revisit how to test this by mocking the stat calls
+                       gotRes[0].Fields[4].Data = make([]byte, 8)
                        gotRes[0].Fields[5].Data = make([]byte, 8)
-                       gotRes[0].Fields[6].Data = make([]byte, 8)
                        if !assert.Equal(t, tt.wantRes, gotRes) {
                                t.Errorf("HandleGetFileInfo() gotRes = %v, want %v", gotRes, tt.wantRes)
                        }
@@ -2860,7 +2860,7 @@ func TestHandleGetFileNameList(t *testing.T) {
                                                                        },
                                                                        name: []byte("testfile-1k"),
                                                                }
-                                                               b, _ := fnwi.MarshalBinary()
+                                                               b, _ := io.ReadAll(&fnwi)
                                                                return b
                                                        }(),
                                                ),