Skip to content

Commit

Permalink
#146: Added a case with non existing file
Browse files Browse the repository at this point in the history
  • Loading branch information
roma-glushko committed Mar 17, 2024
1 parent 7d39d4b commit 5693732
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pkg/config/expander_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,13 @@ func TestExpander_FileContentExpanded(t *testing.T) {
require.NotContains(t, updatedContent, "${file:")
require.Contains(t, updatedContent, "sk-fakeapi-token")
}

func TestExpander_FileDoesntExist(t *testing.T) {
content, err := os.ReadFile(filepath.Clean(filepath.Join(".", "testdata", "expander.file.notfound.yaml")))
require.NoError(t, err)

expander := Expander{}
updatedContent := string(expander.Expand(content))

require.NotContains(t, updatedContent, "${file:")
}
6 changes: 6 additions & 0 deletions pkg/config/testdata/expander.file.notfound.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name: "OpenAI"
api_key: "${file:./testdata/doesntexist}"

params:
- name: budget
value: "$$${file:./testdata/doesntexist}"

0 comments on commit 5693732

Please sign in to comment.