Skip to content

Commit

Permalink
test(file): updated caching configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanholz committed Oct 17, 2023
1 parent aecf830 commit 022a636
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions ingredients/file/fileContains_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,28 @@ import (
"path/filepath"
"testing"

"github.com/gogrlx/grlx/config"
"github.com/gogrlx/grlx/types"
)

func TestContains(t *testing.T) {
tempDir := t.TempDir()
existingFile := filepath.Join(tempDir, "there-is-a-file-here")
os.Create(existingFile)
f, _ := os.Create(existingFile)
defer f.Close()
if _, err := f.WriteString("hello world"); err != nil {
t.Fatal(err)
}
existingFileSrc := filepath.Join(tempDir, "there-is-a-src-here")
f, _ = os.Create(existingFileSrc)
defer f.Close()
if _, err := f.WriteString("hello world"); err != nil {
t.Fatal(err)
}

config.CacheDir = tempDir
defer func() { config.CacheDir = "" }()

tests := []struct {
name string
params map[string]interface{}
Expand Down Expand Up @@ -45,18 +60,6 @@ func TestContains(t *testing.T) {
},
error: types.ErrModifyRoot,
},
// {
// name: "ContainsTest",
// params: map[string]interface{}{
// "name": existingFile,
// },
// expected: types.Result{
// Succeeded: false,
// Failed: true,
// Notes: []fmt.Stringer{types.Snprintf("failed to open cached source")},
// },
// error: nil,
// },
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
Expand Down

0 comments on commit 022a636

Please sign in to comment.