Skip to content
This repository has been archived by the owner on May 16, 2021. It is now read-only.

Commit

Permalink
tests: improve test coverage by adding negative tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mainawycliffe committed Feb 10, 2020
1 parent c6d0433 commit cfcc9ca
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions testdata/users.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dhhdhd,dhhdhd,jsjsjsj
3 changes: 3 additions & 0 deletions utils/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,10 @@ func TestUnmarshalFormatFile(t *testing.T) {
{"Test with JSON File", args{path: "./../testdata/users.json", extension: "json", v: &test1Users}, false, testUserResponse},
{"Test with Yaml File", args{path: "./../testdata/users.yaml", extension: "yaml", v: &test2Users}, false, testUserResponse},
{"No file", args{path: "./../testdata/users1.yaml", extension: "yaml", v: &test2Users}, true, nil},
{"Unsupported Format", args{path: "./../testdata/users.csv", extension: "csv", v: &test2Users}, true, nil},
{"Test with Yaml File (Incorrect Response)", args{path: "./../testdata/users.yaml", extension: "yaml", v: &test2Users}, false, testUserWrongResponse},
{"Test with Wrong JSON File", args{path: "./../testdata/users.csv", extension: "json", v: &test1Users}, true, nil},
{"Test with Wrong Yaml File", args{path: "./../testdata/users.csv", extension: "yaml", v: &test2Users}, true, nil},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
Expand Down

0 comments on commit cfcc9ca

Please sign in to comment.