Skip to content

Commit

Permalink
feat(file): mock file(todo)
Browse files Browse the repository at this point in the history
  • Loading branch information
ahuigo committed Jul 12, 2024
1 parent 9e86f82 commit 0399479
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
4 changes: 2 additions & 2 deletions demo/file-header_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import (
"io"
"testing"

"github.com/ahuigo/gohttptool/file"
"github.com/ahuigo/gohttptool/filetool"
)

func TestCreateFileHeader(t *testing.T) {
content := []byte("hello world")
fd, err := file.CreateFileHeaderFromBytes("test.txt", content)
fd, err := filetool.CreateFileHeaderFromBytes("test.txt", content)
if err != nil {
t.Fatal(err)
}
Expand Down
2 changes: 1 addition & 1 deletion file/file-header.go → filetool/file-header.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package file
package filetool

import (
"bytes"
Expand Down
23 changes: 23 additions & 0 deletions filetool/file-mock.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package filetool

/*
import (
"github.com/spf13/afero"
)
func CreateMockFile(content []byte) error {
var fs = afero.NewMemMapFs()
file, err := fs.Create("test.txt")
if err != nil {
return err
}
defer file.Close()
_, err = file.Write(content)
if err != nil {
return err
}
return nil
}
*/

0 comments on commit 0399479

Please sign in to comment.