Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit

Permalink
Now we have refactored the utilities class we need to rename a few of…
Browse files Browse the repository at this point in the history
… the fields
  • Loading branch information
leeturner committed Aug 21, 2022
1 parent 6692a79 commit 41e0c9f
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions pkg/cmd/utilities_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,29 @@ func TestGetFileContent(t *testing.T) {
log := zaptest.NewLogger(t)
logger := *log.Sugar()
tests := []struct {
testName string
jsonInput string
expectedMD string
expectedErr error
testName string
jsonInputFile string
expectedJson string
expectedErr error
}{
{
testName: "input file does not exist",
jsonInput: "./doesnt-exist.txt",
expectedMD: "",
expectedErr: errors.New("could not open the file"),
testName: "input file does not exist",
jsonInputFile: "./doesnt-exist.txt",
expectedJson: "",
expectedErr: errors.New("could not open the file"),
},
{
testName: "input file does exist",
jsonInput: "../../test-data/dummy-report.json",
expectedMD: `{"ok": false}`,
expectedErr: nil,
testName: "input file does exist",
jsonInputFile: "../../test-data/dummy-report.json",
expectedJson: `{"ok": false}`,
expectedErr: nil,
},
}

for _, data := range tests {
t.Run(data.testName, func(t *testing.T) {
resultMD, resultErr := getFileContent(data.jsonInput, logger)
assert.Equal(t, data.expectedMD, resultMD)
resultMD, resultErr := getFileContent(data.jsonInputFile, logger)
assert.Equal(t, data.expectedJson, resultMD)
assert.Equal(t, data.expectedErr, resultErr)
})
}
Expand Down

0 comments on commit 41e0c9f

Please sign in to comment.